Skip to content

OpenTracing AutoConfiguration crashes with a non-brave OT implementation #1075

@realark

Description

@realark

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions