grafana / otel-profiling-python

Apache License 2.0
1 stars 1 forks source link

Span profiles support for OpenTelemetry in Python

This package enables applications that already rely on OpenTelemetry for distributed tracing and Pyroscope for continuous profiling to link the tracing and profiling data together.

See https://grafana.com/docs/pyroscope/latest/configure-client/trace-span-profiles/ for more information.

Prerequisites

Integration

Add the following package to your project:

pip install pyroscope-otel

Register the PyroscopeSpanProcessor in your OpenTelemetry integration:


from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider

from pyroscope-otel import PyroscopeSpanProcessor

provider = TracerProvider()
provider.add_span_processor(PyroscopeSpanProcessor())

trace.set_tracer_provider(provider)