Skip to content

Commit

Permalink
Add a TracingFactory (added in opentracing-tracerresolver 0.1.5) whic…
Browse files Browse the repository at this point in the history
…h resolves our tracer (#7102)
  • Loading branch information
mcculls authored May 30, 2024
1 parent c2fa83f commit 489de24
Showing 1 changed file with 26 additions and 0 deletions.
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;
}
}
}

0 comments on commit 489de24

Please sign in to comment.