This page contains documentation for OpenTelemetry Java.

Quick Start

Please note that this library is currently in alpha, and shouldn’t be used in production environments.

First, you’ll need to import the OpenTelemetry API and/or SDK into your project.





repositories {
	maven { url '' }

dependencies {

Libraries will usually only need opentelemetry-api, while applications may want to use opentelemetry-sdk.

Next, import the necessary classes in your code.

import io.opentelemetry.trace.Tracer;
import io.opentelemetry.exporters.inmemory.InMemorySpanExporter;

Finally, create a tracer and exporter, then start creating spans.

private final InMemorySpanExporter exporter = InMemorySpanExporter.create();
private final Tracer tracer = createTracer("tracer", exporter);

Span span = tracer.spanBuilder("test").startSpan();
// do work

API Reference