-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Census tracing integration for Firestore. #2729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
garrettjonesgoogle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@bogdandrutu PTAL. The dependency management was in particular quite nasty, and ideas / feedback around that area greatly appreciated.