The OpenTracing project is archived. Learn more.
Migrate to OpenTelemetry today!

Getting Started

Hello World examples

Both of these examples assume that Jaeger is running locally via Docker:

docker run -d -p 5775:5775/udp -p 16686:16686 jaegertracing/all-in-one:latest

These can be adapted to use other OpenTracing-compatible Tracer easily by adjusting the initialization code to match the particular implementation.


Add the Jaeger libraries to your dependencies -

import io.jaegertracing.Configuration;
import io.jaegertracing.Configuration.ReporterConfiguration;
import io.jaegertracing.Configuration.SamplerConfiguration;
import io.jaegertracing.internal.JaegerTracer;
import io.jaegertracing.internal.samplers.ConstSampler;
import io.opentracing.Span;
import io.opentracing.util.GlobalTracer;


SamplerConfiguration samplerConfig = SamplerConfiguration.fromEnv()

ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv()

Configuration config = new Configuration("helloWorld")


Span parent = GlobalTracer.get().buildSpan("hello").start();
try (Scope scope = GlobalTracer.get().scopeManager()
      .activate(parent)) {
    Span child = GlobalTracer.get().buildSpan("world")
    try (Scope scope = GlobalTracer.get().scopeManager()
       .activate(child)) {


import (


func main() {
    cfg := config.Configuration{
	Sampler: &config.SamplerConfig{
	    Type:  "const",
	    Param: 1,
	Reporter: &config.ReporterConfig{
	    LogSpans:            true,
	    BufferFlushInterval: 1 * time.Second,
    tracer, closer, err := cfg.New(
    defer closer.Close()



func someFunction() {
    parent := opentracing.GlobalTracer().StartSpan("hello")
    defer parent.Finish()
    child := opentracing.GlobalTracer().StartSpan(
	"world", opentracing.ChildOf(parent.Context()))
    defer child.Finish()

Self-guided Walkthrough Tutorials


Take OpenTracing for a HotROD Ride involves successive optimizations of a Go-based Ride-on-Demand demonstration service, all informed by tracing data.


MicroDonuts shows the reader how to get tracing instrumentation added to a multi-service app, and includes properly-configured initialization of several OpenTracing-compatible Tracers.

Multiple languages

The OpenTracing Tutorial provides an example combining Go, Java, Python, and Node.js.