Step 1: Install the OpenTelemetry SDK
Install the relevant OpenTelemetry packages:Terminal
opentelemetry-bootstrap command to automatically install any OTel libraries based on your current Python app.
Terminal
Step 2: Initialize the instrumentation
Notice theHttpHeaderSampler class. This is a custom, head-based sampler that will only sample spans that are generated
by Checkly by inspecting the trace state. This way you only pay for the egress traffic generated by Checkly and not for
any other traffic.
flask-instrumentation.py
Step 3: Start your app with the instrumentation
Toggle on Import Traces and grab your OTel API key in the OTel API keys section of the Traces page in the Checkly app and take a note of the endpoint for the region you want to use.
OTEL_EXPORTER_OTLP_HEADERS environment variable.
Terminal
Terminal
Terminal
Finally, start your app with the Flask CLI:
Terminal