Census tracing integration for Firestore.#2729
Conversation
google-cloud-firestore/pom.xml
Outdated
| <dependency> | ||
| <groupId>io.opencensus</groupId> | ||
| <artifactId>opencensus-api</artifactId> | ||
| <version>0.10.1</version> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
I updated the PR to use census from BOM instead. |
|
|
||
| numResponses++; | ||
| if (numResponses == 1) { | ||
| Tracing.getTracer() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| private static final String AUTO_ID_ALPHABET = | ||
| "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | ||
|
|
||
| public static final Tracer tracer = Tracing.getTracer(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| span); | ||
| } else { | ||
| span.setStatus( | ||
| io.opencensus.trace.Status.ABORTED.withDescription("too many retries")); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| @Override | ||
| public void onError(Throwable throwable) { | ||
| Tracing.getTracer().getCurrentSpan().addAnnotation("Firestore.BatchGet: Error"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| numResponses++; | ||
| if (numResponses == 1) { | ||
| Tracing.getTracer() | ||
| .getCurrentSpan() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
danchia
left a comment
There was a problem hiding this comment.
Thanks for the feedback, hope this addresses things.
| private static final String AUTO_ID_ALPHABET = | ||
| "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | ||
|
|
||
| public static final Tracer tracer = Tracing.getTracer(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| numResponses++; | ||
| if (numResponses == 1) { | ||
| Tracing.getTracer() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| numResponses++; | ||
| if (numResponses == 1) { | ||
| Tracing.getTracer() | ||
| .getCurrentSpan() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| @Override | ||
| public void onError(Throwable throwable) { | ||
| Tracing.getTracer().getCurrentSpan().addAnnotation("Firestore.BatchGet: Error"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| span); | ||
| } else { | ||
| span.setStatus( | ||
| io.opencensus.trace.Status.ABORTED.withDescription("too many retries")); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| import io.opencensus.trace.Status; | ||
|
|
||
| /** Census tracing utilities. */ | ||
| class TraceUtil { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| import io.opencensus.trace.Status; | ||
|
|
||
| /** Census tracing utilities. */ | ||
| class TraceUtil { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,35 @@ | |||
| /* | |||
| * Copyright 2017 Google Inc. All Rights Reserved. | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| final Transaction.Function<T> transactionCallback, | ||
| final SettableApiFuture<T> resultFuture, | ||
| final TransactionOptions options) { | ||
| Span span = tracer.spanBuilder("CloudFirestore.Transaction").startSpan(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| span); | ||
| } else { | ||
| span.setStatus(TOO_MANY_RETRIES_STATUS); | ||
| span.end(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| ApiStreamObserver<BatchGetDocumentsResponse> responseObserver = | ||
| new ApiStreamObserver<BatchGetDocumentsResponse>() { | ||
| int numResponses; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@pongad do you have any other feedback? |
|
@danchia Sorry for the late response. I was transferring and dropped a bunch of things. This LGTM. @garrettjonesgoogle Do you have any other comments? |
@bogdandrutu PTAL. The dependency management was in particular quite nasty, and ideas / feedback around that area greatly appreciated.