OpenLLMetry
OpenLLMetry instruments your LLM application with OpenTelemetry and emits standard OTLP data. To send it to Logz.io, point the Traceloop SDK at a collector that ships to Logz.io: the Logz.io APM collector on Kubernetes, or an OpenTelemetry collector on any host.
Before you begin, you'll need:
- An LLM application (OpenAI, Anthropic, LangChain, LlamaIndex, and more)
- An active Logz.io Tracing account
Instrument your application
Follow the Traceloop installation guide for your language:
| Language | Guide |
|---|---|
| Python | Getting started with Python |
| Node.js | Getting started with Node.js |
| Next.js | Getting started with Next.js |
| Go | Getting started with Go |
| Ruby | Getting started with Ruby |
AI Observability currently supports Python and Node.js applications built with LangChain or LangGraph. Support for more frameworks, direct LLM SDK calls and other languages is coming soon.
Use the latest SDK release. For Python, traceloop-sdk 0.57.0 or later is required.
Optional settings
| Setting | When you need it | Guide (Python and Node.js) |
|---|---|---|
| Workflow | Your app calls an LLM SDK directly (for example OpenAI, Anthropic or Bedrock) instead of LangChain or LangGraph. Wrap each agent request in a workflow so it appears as a run. | Workflow annotations |
| Session | You want to see the runs of one conversation together. Set the association property thread_id to your conversation ID. | Association properties |
Send your data to Logz.io
- Kubernetes
- OpenTelemetry collector
Deploy the Logz.io APM collector
If you already run the logzio-monitoring chart with logzio-apm-collector.enabled=true, skip to the next step.
helm repo add logzio-helm https://logzio.github.io/logzio-helm && helm repo update
helm install -n monitoring --create-namespace \
--set logzio-apm-collector.enabled=true \
--set logzio-apm-collector.SamplingProbability=100 \
--set global.logzioTracesToken="<<TRACING-SHIPPING-TOKEN>>" \
--set global.logzioRegion="<<LOGZIO_ACCOUNT_REGION_CODE>>" \
--set global.env_id="<<CLUSTER-NAME>>" \
logzio-monitoring logzio-helm/logzio-monitoring
- Replace
<<TRACING-SHIPPING-TOKEN>>with the token of the account you want to ship to. - Replace
<<LOGZIO_ACCOUNT_REGION_CODE>>with the applicable region code. - Replace
<<CLUSTER-NAME>>with a name for your cluster. It appears as the Environment of your runs.
SamplingProbability=100 keeps every trace, so every agent run appears in AI Observability.
For all chart options, see Kubernetes.
Point your application at the collector
Add the following environment variables to your application's container:
env:
- name: TRACELOOP_BASE_URL
value: http://logzio-apm-collector.monitoring.svc.cluster.local:4318
- name: TRACELOOP_METRICS_ENABLED
value: "false"
# Optional: set to "false" to stop recording prompts and responses
- name: TRACELOOP_TRACE_CONTENT
value: "true"
- The APM collector receives traces only, so SDK metrics are turned off. AI Observability is built from traces.
- By default, OpenLLMetry records prompts, responses, and tool inputs and outputs on the spans. These may contain personal data. Set
TRACELOOP_TRACE_CONTENTto"false"to turn this off.
The service name shown in Logz.io comes from the SDK's app_name (appName in Node.js) initialization option.
Point the SDK at your collector
Set the following environment variables for your application:
export TRACELOOP_BASE_URL=http://<<COLLECTOR-HOST>>:4318
# Optional: set to false to stop recording prompts and responses
export TRACELOOP_TRACE_CONTENT=true
If your SDK supports it, you can also send prompts and completions as log events:
export TRACELOOP_LOGGING_ENABLED=true
- Replace
<<COLLECTOR-HOST>>with the hostname of the OpenTelemetry collector, for examplelocalhost. - By default, OpenLLMetry records prompts, responses, and tool inputs and outputs on the spans. These may contain personal data. Set
TRACELOOP_TRACE_CONTENT=falseto turn this off. - The service name shown in Logz.io comes from the SDK's
app_name(appNamein Node.js) initialization option. See the Traceloop configuration options.
Download and configure the OpenTelemetry collector
Create a dedicated directory on the collector host and download the OpenTelemetry collector contrib for your operating system.
This integration uses OpenTelemetry Collector Contrib, not the OpenTelemetry Collector Core.
Create a config.yaml file with the following content:
receivers:
otlp:
protocols:
http:
endpoint: "0.0.0.0:4318"
processors:
batch:
exporters:
logzio/traces:
account_token: <<TRACING-SHIPPING-TOKEN>>
region: <<LOGZIO_ACCOUNT_REGION_CODE>>
headers:
user-agent: logzio-opentelemetry-traces
logzio/logs:
account_token: <<LOG-SHIPPING-TOKEN>>
region: <<LOGZIO_ACCOUNT_REGION_CODE>>
headers:
user-agent: logzio-opentelemetry-logs
prometheusremotewrite/logzio:
endpoint: https://<<LISTENER-HOST>>:8053
headers:
Authorization: Bearer <<PROMETHEUS-METRICS-SHIPPING-TOKEN>>
user-agent: logzio-opentelemetry-metrics
target_info:
enabled: false
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logzio/traces]
logs:
receivers: [otlp]
processors: [batch]
exporters: [logzio/logs]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [prometheusremotewrite/logzio]
- Replace
<<TRACING-SHIPPING-TOKEN>>with the token of the account you want to ship to. - Replace
<<LOGZIO_ACCOUNT_REGION_CODE>>with the applicable region code. - Replace
<<LOG-SHIPPING-TOKEN>>with the log shipping token of the account you want to ship to. - Replace
<<LISTENER-HOST>>with the Logz.io listener URL for your region. - Replace
<<PROMETHEUS-METRICS-SHIPPING-TOKEN>>with a token for the metrics account you want to ship to.
Not every OpenLLMetry SDK emits all three signals. Check your SDK's guide and the Traceloop configuration options for what it exports, and remove any pipeline you don't need.
The configuration doesn't sample traces, so every agent run is kept and run counts stay accurate.
Start the collector
Run the following command:
<path/to>/otelcol-contrib --config ./config.yaml
- Replace
<path/to>with the path to the directory where you downloaded the collector.
To run the collector in Docker instead, mount the configuration file:
docker run \
-p 4318:4318 \
-v <PATH-TO>/config.yaml:/etc/otelcol-contrib/config.yaml \
otel/opentelemetry-collector-contrib:<VERSION>
- Replace
<PATH-TO>with the path to theconfig.yamlfile on your system. - Replace
<VERSION>with the collector version to run (see available versions).
When running the OTEL collector in a Docker container, your application should run in separate containers on the same host network. Ensure all containers share the same network. Using Docker Compose ensures that all containers, including the OTEL collector, share the same network configuration automatically.
View your data in Logz.io
Run your LLM application to generate some data, then give it time to process:
- AI Observability shows your agent runs. Search runs, open a run to see each step, and use the Monitoring tab for an overview of volume, errors, latency and tokens. AI Observability is in beta; contact Logz.io Support to enable it for your account.
- Traces appear in your Tracing dashboard. Each LLM call is a span, with the model, prompt, completion and token usage as span attributes.
- Metrics (OpenTelemetry collector setup) appear in your Metrics dashboard, under metric names starting with
gen_ai_,llm_ordb_. - Logs (OpenTelemetry collector setup) appear in Explore.