Skip to main content
Version: v0.4.0

Telemetry

The preferred way to instrument Llama Stack is with OpenTelemetry. Llama Stack enriches the data collected by OpenTelemetry to capture helpful information about the performance and behavior of your application. Here is an example of how to forward your telemetry to an OTLP collector from Llama Stack:

export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4318"
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_SERVICE_NAME="llama-stack-server"

uv pip install opentelemetry-distro opentelemetry-exporter-otlp
uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement -

uv run opentelemetry-instrument llama stack run config.yaml

Known issues​

Some database instrumentation libraries have a known bug where spans get wrapped twice, or do not get connected to a trace. To prevent this, you can disable database specific tracing, and rely just on the SQLAlchemy tracing. If you are using sqlite3 as your database, for example, you can disable the additional tracing like this:

export OTEL_PYTHON_DISABLED_INSTRUMENTATIONS="sqlite3"