question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApmScopeManager.active() is returning scope with finishSpanOnClose always set to false

See original GitHub issue

Describe the bug Based on the code: https://github.com/elastic/apm-agent-java/blob/master/apm-opentracing/src/main/java/co/elastic/apm/opentracing/ApmScopeManager.java#L58-L67, when the app gets the current active scope from APM tracer like this:

Scope scope = tracer.scopeManager().active();

the returned scope object always has finishSpanOnClose set to false, if we close the scope, the current span inside scope is not finished. This is causing spans created by opentracing/java-spring-messaging being dropped.

To Reproduce This issue can be simply reproduced by debugging the below snippet:

Tracer tracer = new ElasticApmTracer();
tracer.buildSpan("test")
  .startActive(true);
Scope scope = tracer.scopeManager().active();
// verify that finishSpanOnClose is false.
scope.close();

Or it can be reproduced end-to-end by having a spring-cloud-stream app with opentracing/java-spring-messaging. The spans produced by the library is not shipped to Elastics.

Expected behaviour tracer.scopeManager().active() returns a Scope object that preserves the finishSpanOnClose config from current active scope.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jzhncommented, Jul 10, 2019

@felixbarny : you are right, thanks for pointing that out!

@eyalkoren : sorry for wasting your time for supporting deprecated methods. I’ll create an PR to update java-spring-messaging instead.

0reactions
eyalkorencommented, Jul 22, 2019

@jzhn please note we will not merge the PR referenced above. Did you create a PR for stop using the deprecated API?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AngularJS directive transclude scope=false? - Stack Overflow
You can workaround this by setting a member on an object in the scope (obj.var) ... is to explicitly call the $parent scope...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found