Skip to main content
OpenLIT automatically creates OpenTelemetry spans for every instrumented LLM call, agent step, vector database query, and HTTP request in your application. You get end-to-end distributed traces with no manual instrumentation.

What is captured automatically

Every auto-instrumented span includes:

Control content capture

By default, OpenLIT captures prompt and response content as span attributes. Disable this for privacy-sensitive workloads:
Or use the environment variable:

Limit content length

To cap the size of captured content and reduce trace storage costs, set max_content_length to a positive integer. Content exceeding the limit is truncated with ... appended. None (default), 0, or -1 disables truncation.
Or via environment variable:

Disable batch processing

By default, the SDK uses the OpenTelemetry batch span processor. During local development you may want spans to appear immediately:

Disable specific instrumentations

OpenLIT automatically detects and instruments all supported libraries it finds in your environment. To skip specific ones:

Use an existing tracer

If your application already configures an OpenTelemetry tracer, pass it to OpenLIT so both use the same provider:

Add custom resource attributes

OpenLIT sets the following resource attributes on every span by default:
  • telemetry.sdk.name: openlit
  • service.name: <your service name>
  • deployment.environment: <your environment>
You can add your own attributes on top using the standard OpenTelemetry environment variable:

Manual tracing

For code that is not auto-instrumented, you can create custom spans using the @openlit.trace decorator or the openlit.start_trace context manager.

Decorator

Apply @openlit.trace to a function. Any auto-instrumented LLM calls made inside the function are grouped under the parent span:

Context manager

For more control — including setting a result value and custom metadata — use openlit.start_trace:
TracedSpan methods:

Configuration

All init() parameters including content capture options

Integrations

Full list of auto-instrumented libraries

Destinations

Send traces to Datadog, Grafana, New Relic, and more