Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

[jaeger/apache-http-instrumentation] TracingRequestInterceptor gets span from http request context vs tracer scope manager - #378

Merged
yurishkuro merged 3 commits into
jaegertracing:masterfrom
dray92:investigate_client_instrumentation
Apr 6, 2018
Merged

[jaeger/apache-http-instrumentation] TracingRequestInterceptor gets span from http request context vs tracer scope manager#378
yurishkuro merged 3 commits into
jaegertracing:masterfrom
dray92:investigate_client_instrumentation

Conversation

@dray92

@dray92 dray92 commented Apr 5, 2018

Copy link
Copy Markdown
Contributor

SpanCreationRequestInterceptor#process creates a new span for the outbound request and
stores it as attribute in http context

...
httpContext.setAttribute(Constants.CURRENT_SPAN_CONTEXT_KEY, clientSpan);

Point to be noted here is that this newly created span is not marked as the current
active span
in the tracer's scope manager (which is totally fine). TracingRequestInterceptor
was trying to access this very span from the tracer's scope manager (which is not guaranteed
to be not-null). Clearly, TracingRequestInterceptor should be trying to access the current
span from the context of the current outbound request and not the tracer's thread local storage.

Signed-off-by: Debosmit Ray debo@uber.com

debosmit added 2 commits April 5, 2018 10:31
…pan from http request context vs tracer scope manager

Signed-off-by: Debosmit Ray <debo@uber.com>
Signed-off-by: Debosmit Ray <debo@uber.com>
onSpanStarted(clientSpan, httpRequest, httpContext);
} else {
log.warn("Current scope is null; possibly failed to start client tracing span.");
log.warn("Current client span is null; SpanCreationRequestInterceptor possibly failed to start client tracing span.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we already have a test for TracingRequestInterceptor, is it possible to add a check that log.warn is not called? With the expectation that without this change such check will fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds like a good idea

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yurishkuro checking for logger state was definitely (not) a fun activity haha
ended up using a test-focused in-memory logger.

Signed-off-by: Debosmit Ray <debo@uber.com>
@codecov

codecov Bot commented Apr 5, 2018

Copy link
Copy Markdown

Codecov Report

Merging #378 into master will decrease coverage by 0.04%.
The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #378      +/-   ##
============================================
- Coverage      84.6%   84.56%   -0.05%     
+ Complexity      622      621       -1     
============================================
  Files            95       95              
  Lines          2468     2468              
  Branches        276      276              
============================================
- Hits           2088     2087       -1     
  Misses          284      284              
- Partials         96       97       +1
Impacted Files Coverage Δ Complexity Δ
...r/jaeger/httpclient/TracingRequestInterceptor.java 72.22% <50%> (ø) 4 <0> (ø) ⬇️
.../uber/jaeger/samplers/RemoteControlledSampler.java 84.84% <0%> (-1.02%) 19% <0%> (-1%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afc7bec...45e37e5. Read the comment docs.

@yurishkuro

Copy link
Copy Markdown
Member

84.56% (-0.05%) compared to afc7bec

weird... did you remove some tests / paths? or is this just flaky?

@dray92

dray92 commented Apr 5, 2018

Copy link
Copy Markdown
Contributor Author

I think its being flaky -- clicked into the codecov patch report

changes seem to be in:

  • RemoteControlledSampler.java (untouched in diff)
  • TracingRequestInterceptor -- unclear as to the reason why it thinks that log.warn is untested

@yurishkuro
yurishkuro merged commit c927b80 into jaegertracing:master Apr 6, 2018
@dray92
dray92 deleted the investigate_client_instrumentation branch April 6, 2018 01:55
@binhexyz

Copy link
Copy Markdown

can we have new release?
Thanks.

@yurishkuro

Copy link
Copy Markdown
Member

preparing release jaegertracing/legacy-client-java#12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants