Get a DemoStart Free TrialSign In

OpenTelemetry Python Configuration

Ship traces from Python to Opensearch with OpenTelemetry (via gRPC)

Use OpenTelemetry to easily send Python traces to your Logit.io Stack.

Send Your DataAPMLanguages & LibrariesOpenTelemetry Python Configuration Guide

Follow this step by step guide to get 'traces' from your system to Logit.io:

Step 1 - Getting Started

The official OpenTelemetry documentation contains a lot of useful guidance for how to implement tracing. The purpose of this document is to explain how to send your telemetry data to the OpenTelemetry Collector hosted by Logit.io.

The snippet below shows a breakdown of the Command Line Arguments required to send the trace data to Logit.io

# The instrumented application is called using this command
opentelemetry-instrument

# The traces are exported to the OpenTelemetry Collector
--traces_exporter otlp

# This is where Logit.io host the OpenTelemetry Collector
--exporter_otlp_endpoint https://<your-opentelemetry-endpoint-address>:<your-opentelemetry-endpoint-port>

# This can be either grpc or http/protobuf
--exporter_otlp_traces_protocol <your-opentelemetry-protocol>

# We authenticate the access to the collector using Basic authentication in an http header (which is safe because we are using the https protocol)
--exporter_otlp_traces_headers "Authorization=Basic%20<your-encoded-opentelemetry-auth-header-value>"

# If we don't set this argument to console (and we aren't interested in sending the metrics to Logit.io) then we could receive errors in the Python IDE
--metrics_exporter console

# If we don't set the service name it will appear in Jaeger as 'unknown_service'
--service_name your-service-name

# an example of the application being instrumented (your own app details should be entered here)
python -m flask run -p 8080

So the full command including arguments is:

opentelemetry-instrument --traces_exporter otlp --exporter_otlp_endpoint https://<your-opentelemetry-endpoint-address>:<your-opentelemetry-endpoint-port> --exporter_otlp_traces_protocol <your-opentelemetry-protocol> --exporter_otlp_traces_headers "Authorization=Basic%20<your-encoded-opentelemetry-auth-header-value>" --metrics_exporter console --service_name your-service-name python -m flask run -p 8080

Step 2 - Alternative to Command Line arguments

Instead of specifying the arguments when calling the instrumentation application you can also set these as Environment Variables.

Step 3 - Check Logit.io for your traces

Data should now have been sent to your Stack.

View my data

If you don't see traces please take a look at How to diagnose no data in Stack below for how to diagnose common issues.

Step 4 - how to diagnose no data in Stack

If you don't see data appearing in your Stack after following the steps, visit the Help Centre guide for steps to diagnose no data appearing in your Stack or Chat to support now.

Return to Search
Sign Up

© 2024 Logit.io Ltd, All rights reserved.