Instrument your Python application with zero code changes using OpenTelemetry auto-instrumentation. Supports Flask, FastAPI, Django, and dozens of popular libraries out of the box.
pip install opentelemetry-sdk \
opentelemetry-exporter-otlp-proto-http \
opentelemetry-instrumentation # tracing.py
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
provider = TracerProvider()
exporter = OTLPSpanExporter(
endpoint="https://ingest.maple.dev/v1/traces",
headers={"Authorization": "Bearer your-api-key"},
)
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)
# Create a tracer and send a test span
tracer = trace.get_tracer("quickstart")
with tracer.start_as_current_span("hello-maple"):
print("Trace sent!") Automatic spans for every HTTP request with route, method, and status code attributes.
Database query spans with statement text, connection details, and execution duration.
Outgoing requests via urllib3 and the requests library traced with context propagation.
Redis command spans with operation type, key patterns, and response time.
Distributed task spans that link producers and consumers across worker processes.
Client and server gRPC spans with service, method, and status code attributes.