Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jaeger exporter details for python #3406

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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