Skip to content

Commit

Permalink
Update jaeger exporter details for python (open-telemetry#3406)
Browse files Browse the repository at this point in the history
  • Loading branch information
svrnm authored Oct 19, 2023
1 parent b6d8466 commit 3c8c0e5
Showing 1 changed file with 10 additions and 59 deletions.
69 changes: 10 additions & 59 deletions content/en/docs/instrumentation/python/exporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c8c0e5

Please sign in to comment.