Skip to content

Instantly share code, notes, and snippets.

@carlosalberto
Last active May 4, 2021 19:31
Show Gist options
  • Save carlosalberto/08ff928d5c402f64b99609e6e620da4d to your computer and use it in GitHub Desktop.
Save carlosalberto/08ff928d5c402f64b99609e6e620da4d to your computer and use it in GitHub Desktop.
import java.util.GlobalTracer;
public static void Main() {
// Don't create any extra objects, unless needed.
GlobalTracer.registerIfAbsent(TracerCallable.INSTANCE);
Span span = GlobalTracer.get().buildSpan("myOperation").start();
}
class TracerCallable implements Callable<Tracer> {
public static final TracerCallable INSTANCE = new TracerCallable();
@Override
public Tracer call(Tracer tracer) {
// Set configuration
Configuration configuration = new Configuration("foo");
// Create Tracer
return configuration.getTracer();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment