Quickstart: LLM Observablity
Production-ready AI monitoring setup in 2 simple steps with zero code changes
Integrations
60+ AI integrations with automatic instrumentation and performance tracking
Using an existing OTel TracerProvider
If your application already configures OpenTelemetry, OpenLIT reuses it instead of creating its own. Set your SDKTracerProvider as the global provider before calling openlit.init(); OpenLIT detects it and attaches its instrumentation to that provider.
openlit.init() does not take a tracer argument.
When an existing provider is reused, OpenLIT does not add exporters to it, so otlp_endpoint / otlp_headers have no effect. Configure exporters on your own TracerProvider.
Example:
Add custom resource attributes
TheOTEL_RESOURCE_ATTRIBUTES environment variable allows you to provide additional OpenTelemetry resource attributes when starting your application with OpenLIT. OpenLIT already includes some default resource attributes:
telemetry.sdk.name: openlitservice.name: YOUR_SERVICE_NAMEdeployment.environment: YOUR_ENVIRONMENT_NAME
OTEL_RESOURCE_ATTRIBUTES variable. Your custom attributes will be added on top of the existing OpenLIT attributes, providing additional context to your telemetry data. Simply format your attributes as key1=value1,key2=value2.
For example:
Disable Tracing of Content
By default, OpenLIT adds the prompts and completions to Trace span attributes. However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces. Example:Limit Content Length
By default, OpenLIT captures full prompt and completion content without any truncation. If you want to limit the size of captured content (for example, to reduce trace storage costs or avoid excessively large spans), setmax_content_length to a positive integer. Content exceeding the limit will be truncated with ... appended.
A value of None (the default), 0, or -1 disables truncation entirely.
Example:
Disable Batch
By default, the SDK batches spans using the OpenTelemetry batch span processor. When working locally, sometimes you may wish to disable this behavior. You can do that with this flag. Example:Disable Instrumentations
By default, OpenLIT automatically detects which models and frameworks you are using and instruments them for you. You can override this and disable instrumentation for specific frameworks and models. Example:Manual Tracing
Usingopenlit.trace, you get access to manually create traces, allowing you to record every process within a single function.
python
trace function automatically groups any LLM function invoked within generate_one_liner, providing you with organized groupings right out of the box.
You can do more with traces by running the start_trace context generator:
python
trace.set_result('') to set the final result of the trace and trace.set_metadata({}) to add custom metadata.
Full Example
python
Deploy OpenLIT
Deployment options for scalable LLM monitoring infrastructure
Integrations
60+ AI integrations with automatic instrumentation and performance tracking
Destinations
Send elemetry to Datadog, Grafana, New Relic, and other observability stacks

