Uh oh!
There was an error while loading. Please reload this page.
Add OpenCensus tracing instrumentation in google-http-client module. - #393
Conversation
30e4166 to
9b542cfCompareHailongWen
commented
Jan 28, 2018
Hi @mattwhisenhunt , would you please kindly help on this PR? |
| * Sets the {@link TextFormat} used in context propagation. | ||
| * @param textFormat the text format. | ||
| */ | ||
| public static void setPropagationTextFormat(@Nullable TextFormat textFormat) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * Sets the {@link TextFormat.Setter} used in context propagation. | ||
| * @param textFormatSetter the {@code TextFormat.Setter} for the text format. | ||
| */ | ||
| public static void setPropagationTextFormatSetter(@Nullable TextFormat.Setter textFormatSetter) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * {@link TextFormat.Setter} for {@link activeTextFormat}. | ||
| */ | ||
| @Nullable | ||
| static TextFormat.Setter propagationTextFormatSetter = null; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| Preconditions.checkNotNull(requestMethod); | ||
| Preconditions.checkNotNull(url); | ||
| Span span = tracer.spanBuilder(traceSpanNamePrefix + "execute").startSpan(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| public static void propagateTracingContext(HttpHeaders headers) { | ||
| Preconditions.checkNotNull(headers); | ||
| if (propagationTextFormat != null && propagationTextFormatSetter != null) { | ||
| Span span = tracer.getCurrentSpan(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| } | ||
| } while (retryRequest); | ||
| span.end(OpenCensusUtils.getEndSpanOptions(response == null ? null : response.getStatusCode())); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| // execute | ||
| lowLevelHttpRequest.setTimeout(connectTimeout, readTimeout); | ||
| // switch tracing scope to current span | ||
| Scope ws = tracer.withSpan(span); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This PR adds OpenCensus-Java instrumentation in to monitor and record events when executing
HttpExecute#execute().The instrumentation starts a
Spanwhen the method begins, and is ended before the method exits. The status of the span will be determined according to the status of the response. ThisSpanis stored into local span store, and can be optionally exported if user explicitly configure an exporter (e.g. stackdriver exporter).Spans can have children. In this case, the generatedSpanin the instrumentation will be parent of all theSpans generated by server-side procedure. To link the childrenSpanwith their parent, the context information should be propagated to server side. This is done by using OpenCensus HTTP Util to inject the information into the header in the request.Added
OpenCensusUtilsprovides helper methods to perform context propagation, and setting end status of span.The added dependency of
opencensus-apicontains basic no-op implementation. It will be replaced by real implementation if user explicitly adds dependency ofopencensus-imploropencensus-impl-lite(for android and gae) in the classpath.This PR does not contain integration test when
opencensus-implis provided. It can be added with the help of maintainers.