Overview

Elastic APM is a powerful solution for monitoring the performance of your applications. As Elastic APM is OpenTelemetry (OTel) compatible by default, you will only need to set the following environment variables to start tracing.

We Support all opentelemetry environment variables as well e.g: OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS.

export LANGTRACE_API_HOST="<https://your-elastic-apm-endpoint:443/v1/traces>"
export LANGTRACE_HEADERS="Authorization=Bearer your-elastic-apm-token"
export OTEL_SERVICE_NAME=your-elastic-service

Initialize the Langtrace SDK

from langtrace_python_sdk import langtrace
langtrace.init()

# rest of your code

Troubleshooting

Traces not visible in Elastic APM:

  • Ensure that all required environment variables are set correctly. Double-check the variable names and values.
  • Also ensure that your LANGTRACE_API_HOST or OTEL_EXPORTER_OTLP_ENDPOINT is correct. You need to add /v1/traces at the end of your endpoint.

Additional Resources