kubit-otel sends OpenTelemetry spans from a Python app to Kubit. It has two entry points: configure() when Kubit is your only exporter, and attach() when your app already creates a TracerProvider. This page covers both, plus the settings to check before production.
Before you start
- Python 3.9 or later
- A Kubit API key in
KUBIT_API_KEY
KUBIT_API_KEY environment variable. Each key belongs to one workspace.
Prompt for your coding agent
Install
Choose configure() or attach()
You have no OpenTelemetry setup
Createkubit_instrumentation.py and import it first in your entrypoint.
kubit_instrumentation.py
main.py
configure() parameters
You already have a TracerProvider
Callattach() after trace.set_tracer_provider(), in the module that creates the provider:
tracing.py
attach() finds the global provider and adds KubitSpanProcessor to it. Your provider’s resource (service.name, service.version) applies to the spans Kubit receives.
attach() parameters
Availability:
attach() must run after trace.set_tracer_provider(). Called earlier, it finds no provider to attach to.
Trace LLM and tool calls
Kubit receives whatever spans your app produces. To get one span per LLM call, add the OpenTelemetry GenAI instrumentor for your client afterconfigure() or attach():
kubit_instrumentation.py
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true puts prompt and response text on the spans. Polaris labels spans from that text.
For tool calls, wrap each tool in its own span so it shows up as a step in the execution path:
tools.py
Before production
Verify
Send a test span:“Show me traces from the last 15 minutes for service support-agent”The result includes a trace with a root span named
hello-kubit.
If it fails
Next steps
- Span attributes: the attribute keys Atlas reads.
- Is my data flowing?: step-by-step checks.