From 3c8c0e539a89efd320379990bce6a31dd1e8fd2d Mon Sep 17 00:00:00 2001 From: Severin Neumann Date: Thu, 19 Oct 2023 10:13:28 +0200 Subject: [PATCH] Update jaeger exporter details for python (#3406) --- .../docs/instrumentation/python/exporters.md | 69 +++---------------- 1 file changed, 10 insertions(+), 59 deletions(-) diff --git a/content/en/docs/instrumentation/python/exporters.md b/content/en/docs/instrumentation/python/exporters.md index 130f204b22d2..dd866880b7d7 100644 --- a/content/en/docs/instrumentation/python/exporters.md +++ b/content/en/docs/instrumentation/python/exporters.md @@ -197,71 +197,22 @@ There is not currently an OTLP/HTTP metric exporter. ## Jaeger -If you are using [Jaeger](https://www.jaegertracing.io/) to visualize trace -data, you'll need to set it up first. This is how to run it in a docker -container: - -```sh -docker run -d --name jaeger \ +[Jaeger](https://jaegertracing.io) natively supports OTLP. Follow the +instructions on +[setting up the OTLP exporter above](#otlp-endpoint-or-collector). You can then +run Jaeger in a docker container with the UI accessible on port 16686 and OTLP +enabled on ports 4137 and 4138: + +```shell +docker run --rm \ -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \ - -p 5775:5775/udp \ - -p 6831:6831/udp \ - -p 6832:6832/udp \ - -p 5778:5778 \ -p 16686:16686 \ - -p 14268:14268 \ - -p 14250:14250 \ + -p 4317:4317 \ + -p 4318:4318 \ -p 9411:9411 \ jaegertracing/all-in-one:latest ``` -Next, install the Jaeger exporter package: - -```sh -pip install opentelemetry-exporter-jaeger -``` - -This will install packages for both: - -- `opentelemetry-exporter-jaeger-thrift` -- `opentelemetry-exporter-jaeger-proto-grpc` - -You can use either to export your traces to Jaeger. - -Once the package is installed, you can configure the exporter when initializing -tracing: - -```python -from opentelemetry import trace -from opentelemetry.exporter.jaeger.thrift import JaegerExporter -from opentelemetry.sdk.resources import SERVICE_NAME, Resource -from opentelemetry.sdk.trace import TracerProvider -from opentelemetry.sdk.trace.export import BatchSpanProcessor - -resource = Resource(attributes={ - SERVICE_NAME: "your-service-name" -}) - -jaeger_exporter = JaegerExporter( - agent_host_name="localhost", - agent_port=6831, -) - -provider = TracerProvider(resource=resource) -processor = BatchSpanProcessor(jaeger_exporter) -provider.add_span_processor(processor) -trace.set_tracer_provider(provider) - -# Merrily go about tracing! -``` - -The previous example uses thrift. To use protobuf, change the import declaration -to: - -```python -from opentelemetry.exporter.jaeger.proto.grpc import JaegerExporter -``` - ## Zipkin If you are using [Zipkin](https://zipkin.io/) to visualize trace data, you'll