This simple Flask app that returns "Hello World". This app configures OpenTelemetry to send data to Honeycomb using the opentelemetry_instrument command and environment variables.
It also contains examples of:
- sending metrics with OpenTelemetry using a counter
- using baggage with context tokens
- manually passing baggage with context
- setting a span attribute
If you are looking for an example using the configure_opentelemetry() function and parameters, check out hello-world app.
You'll also need Poetry installed to run the example. Poetry automatically creates a virtual environment to run the example in so you don't need to manage one yourself.
Install the dependencies:
poetry installRun the application:
poetry run flask runNow you can curl the app:
$ curl localhost:5000
Hello WorldTo send traces to local console:
DEBUG=TRUE poetry run opentelemetry-instrument flask runTo send traces to Honeycomb:
HONEYCOMB_API_KEY="your-api-key" OTEL_SERVICE_NAME="your-service-name" poetry run opentelemetry-instrument flask runTo enable metrics, you will need to set a metrics dataset:
HONEYCOMB_METRICS_DATASET=otel-python-example-metrics
You can configure exporter protocol with this flag:
OTEL_EXPORTER_OTLP_PROTOCOL=grpc or OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf