-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a TracingFactory (added in opentracing-tracerresolver 0.1.5) whic…
…h resolves our tracer (#7102)
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
dd-trace-ot/src/main/java/datadog/opentracing/resolver/DDTracerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package datadog.opentracing.resolver; | ||
|
||
import com.google.auto.service.AutoService; | ||
import datadog.opentracing.DDTracer; | ||
import datadog.trace.api.Config; | ||
import io.opentracing.Tracer; | ||
import io.opentracing.contrib.tracerresolver.TracerFactory; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@AutoService(TracerFactory.class) | ||
public class DDTracerFactory implements TracerFactory { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(DDTracerFactory.class); | ||
|
||
@Override | ||
public Tracer getTracer() { | ||
if (Config.get().isTraceResolverEnabled()) { | ||
log.info("Creating DDTracer with DDTracerFactory"); | ||
return DDTracer.builder().build(); | ||
} else { | ||
log.info("DDTracerFactory disabled"); | ||
return null; | ||
} | ||
} | ||
} |