This repository is a fork of the original opentracing-tutorial updated to use OpenTelemetry API. In these tutorials, we focus on sending traces using the OTLP protocol. Many modern observability backends, such as Signoz, Tempo and Jaeger, support the OTLP (OpenTelemetry Protocol) format either natively or through intermediaries. Instrumenting applications with the OTLP exporter is a flexible approach that allows you to switch backends with minimal changes to the application code.
- Go tutorial
- Python tutorial
- Node.js tutorial
- Java tutorial
- C# tutorial
These tutorials can be followed along using any of the following tracing backends:
Setting up Signoz
Signoz, a distributed tracing backend by Signoz.io, natively supports OTLP. You can directly send OTLP traces to Signoz without an intermediary. The easiest way to set up Signoz is using docker-compose. Refer to their guide for detailed instructions.
Setting up Tempo with Grafana
Tempo, a distributed tracing backend by Grafana, natively supports OTLP. You can directly send OTLP traces to Tempo without an intermediary. For an easy setup, use docker-compose. Refer to their guide for detailed instructions.
Setting up Jaeger
Jaeger is an open-source distributed tracing platform originally developed by Uber Technologies. It supports the OpenTelemetry Protocol (OTLP) natively, allowing you to send traces directly to Jaeger without the need for an intermediary.
To get started with Jaeger using Docker and the default in-memory storage, follow these steps:
-
Start Jaeger via Docker with the necessary ports exposed:
docker run -d --name jaeger \ -e COLLECTOR_OTLP_ENABLED=true \ -p 16686:16686 \ # Jaeger UI -p 4318:4318 \ # OTLP HTTP port jaegertracing/all-in-one:latest
This command runs Jaeger with the OTLP HTTP port (4318) and Jaeger UI (16686) exposed on localhost.
-
Once the backend starts, the Jaeger UI will be accessible at http://localhost:16686.
My main goal was to keep this tutorial as close as possible to the original. Please send me your suggestions and feedback for improving it. I would encourage you to send me pull requests for other languages such as Java, Node.js, and C#.
A collection of tutorials for the OpenTracing API (https://opentracing.io).
Update (Dec 8 2022): Since OpenTracing has been officially retired, I have archived this repository. The tutorials here are still useful when learning about distributed tracing, but using the OpenTelemetry API should be preferred over the OpenTracing API for new applications.
The blog post "Migrating from Jaeger client to OpenTelemetry SDK" can also be used as a reference on how to use the OpenTelemetry SDK as an OpenTracing tracer implementation.
Also check out examples from the book Mastering Distributed Tracing:
- Chapter 4: Instrumentation Basics with OpenTracing
- Chapter 5: Instrumentation of Asynchronous Applications
- Chapter 7: Tracing with Service Mesh
- Chapter 11: Integration with Metrics and Logs
- Chapter 12: Gathering Insights Through Data Mining
The tutorials are using CNCF Jaeger (https://jaegertracing.io) as the tracing backend. For this tutorial, we'll start Jaeger via Docker with the default in-memory storage, exposing only the required ports. We'll also enable "debug" level logging:
docker run \
--rm \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 16686:16686 \
jaegertracing/all-in-one:1.7 \
--log-level=debug
Alternatively, Jaeger can be downloaded as a binary called all-in-one
for different platforms from https://jaegertracing.io/download/.
Once the backend starts, the Jaeger UI will be accessible at http://localhost:16686.