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.

OpenTracing AutoConfiguration crashes with a non-brave OT implementation

See original GitHub issue

OpenTracingAutoConfiguration creates a Brave Tracer if OpenTracing classes are on the classpath.

https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java#L40-L41

This crashes the app if a non-brave OT implementation is used. To Repro:

  1. Launch SpringBoot2 with a Datadog JavaAgent with no Brave classes present: https://docs.datadoghq.com/tracing/setup/java/#installation-and-getting-started
  2. App will crash on startup: java.lang.ClassNotFoundException: brave.opentracing.BraveTracer

As a workaround, the OT configuration can be disabled.

https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java#L39

Seems like a simple fix would be to add a check for a brave implementation to the OT autoconfiguration.

@ConditionalOnClass(Tracer.class, BraveTracer.clss)

Happy to open a PR if that helps.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
realarkcommented, Aug 30, 2018

@adriancole Thanks for the explanation. That makes sense. Usually better to crash early than behave strangely later.

In terms of putting OT on the classpath, that’s an early design decision of the dd tracer. We’re working to decouple the dd tracer from OT so we don’t have to inject OT classes for javaagent users.

1reaction
devinsbacommented, Aug 27, 2018

This won’t actually work the way you are expecting it to. If you disable the BraveTracer and create an instance of some OtherTracer then you will end up with 2 different tracing systems; sleuth (built on brave) and your OT tracer. The OT support in Sleuth is explicitly to allow the use of OT instrumentation not to swap the tracer since sleuth is a tracer itself historically.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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