Introducing native support for OpenTelemetry in Jaeger
The latest Jaeger v1.35 release introduced the ability to receive OpenTelemetry trace data via the OpenTelemetry Protocol (OTLP), which all OpenTelemetry SDKs are required to support. This is a follow-up to the previous announcement to retire Jaeger’s “classic” client libraries.
With this new capability, it is no longer necessary to use the Jaeger exporters with the OpenTelemetry SDKs, or to run the OpenTelemetry Collector in front of the Jaeger backend. Using the OTLP exporter, the SDKs can be configured to send the data directly to the Jaeger backend. The OTLP receiver accepts data via gRPC and HTTP endpoints (gRPC mode had an issue that was patched in 1.35.1).
Primer
Let’s see this functionality in action. First, start the Jaeger all-in-one as described in the Getting Started documentation:
docker run --name jaeger \
-e COLLECTOR_OTLP_ENABLED=true \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
jaegertracing/all-in-one:1.35
Notice that compared to the previous releases:
- There are two more ports added to the export list,
4317
and4318
, used by the OTLP receiver to listen for gRPC and HTTP connections. - The OTLP receiver must be enabled via
COLLECTOR_OTLP_ENABLED=true
. - We removed the other ports that are not relevant to this example.
When the Jaeger backend is starting, you should see these two log lines:
{... "msg":"Starting GRPC server on endpoint 0.0.0.0:4317"}
{... "msg":"Starting HTTP server on endpoint 0.0.0.0:4318"}
As usual, the Jaeger UI can be accessed at http://localhost:16686/.
Now let’s use a simple Python program that configures the OpenTelemetry SDK with OTLPSpanExporter
and generates a single-span trace.
Run this program as follows:
pip install -r requirements.txt
OTEL_SERVICE_NAME=primer python3 basic_trace.py
If we now refresh the Search screen in the Jaeger UI, the Services dropdown should contain the service primer
(notice that we pass this service name to the SDK via an environment variable) and the trace from this service should look like this:
The OTLP receiver can be further customized by a number of flags starting with --collector.otlp.*
, available via the help
command in the collector
and all-in-one
binaries. These flags allow changing the port numbers for the two OTLP servers, configuring TLS, and changing some other parameters like the max message size and keep-alive.
Limitations
There are a few caveats with the existing implementation:
- If your application exports both traces and metrics using OTLP, then you would still need to run the OpenTelemetry Collector, because the Jaeger collector can only accept the tracing portion of OTLP data. Alternatively, you may configure the SDK with two OTLP exporters pointing to different backends.
- Not all the options supported by the OTLP receiver in the OpenTelemetry Collector are supported by the Jaeger backend.
- Only the Jaeger collector supports the new OTLP receiver. The Jaeger agent only supports the “classic” Jaeger formats. If your deployment requires a local agent, we recommend running the OpenTelemetry Collector in that capacity.
Try it out
As usual, we are interested in the community’s feedback about this new feature; please comment in the chat room or open an issue.