curl check. It takes about 15 minutes.
Use it when you already run an OpenTelemetry pipeline, can’t add a dependency, or work in a language Kubit has no SDK for. The Kubit SDK for Python and Kubit SDK for Node do the same with less code, and filter out spans that aren’t LLM-related before they leave your process.
Before you start
- A Kubit Agent workspace and its API key in
KUBIT_API_KEY - For Python: Python 3.9 or later
- For Node: Node.js 18 or later and OpenTelemetry JS SDK v2
KUBIT_API_KEY environment variable. Each key belongs to one workspace.
The app shows a new key only once:
This is the only time we'll show you this key. Copy it now. Copy it, or click Download for a .env file, then click I’ve Saved It. The downloaded file names the key KUBIT_OTEL_API_KEY, so rename it to KUBIT_API_KEY.
Availability: API Keys shows only to the Owner and Admin roles, and only in Agent and User workspaces.
Prompt for your coding agent
Connection details
Set
service.name, service.version and deployment.environment on the resource. Kubit maps service.version to Client: Version and deployment.environment to Client: Environment.
Python
Install the OpenTelemetry SDK and the OTLP/HTTP exporter:You have no OpenTelemetry setup
Createkubit_tracing.py and import it first in your entrypoint, before any LLM client is created:
kubit_tracing.py
main.py
You already have a TracerProvider
Add a secondBatchSpanProcessor with the Kubit exporter to the provider you already register. Don’t create a second provider. OpenTelemetry keeps the first global provider and ignores the second.
tracing.py
trace.set_tracer_provider().
Trace LLM calls
Add the OpenTelemetry GenAI instrumentor for your LLM client, and turn on message content so Polaris has text to label:kubit_tracing.py
kubit_tracing.py, after trace.set_tracer_provider(provider).
Add user and session IDs
Setuser.id and session.id on the root span of each request, so Kubit can group traces into sessions and join them to users:
handler.py
Send a test span
force_flush() sends the span before the process exits. Without it, the span can wait in the batch and be lost.
Node
Install the OpenTelemetry JS SDK v2 packages and the OTLP/HTTP protobuf exporter:You have no OpenTelemetry setup
Createkubit-tracing.ts and import it first in your entrypoint, before any LLM client is created:
kubit-tracing.ts
index.ts
You already have a tracer provider
OpenTelemetry JS SDK v2 takes span processors only when the provider is created. Add the Kubit processor to thespanProcessors list of the provider or NodeSDK you already create:
instrumentation.ts
Add user and session IDs
handler.ts
Send a test span
send-test-span.ts
Choose which spans to send
The stock exporter sends every span your provider records, including HTTP, database and framework spans from other auto-instrumentation. The Kubit SDK drops those before they leave your process. With a manual setup, limit what you send in one of these ways:Set the endpoint on the exporter
Pass the endpoint and header to the exporter in code, as in the examples above. TheOTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS environment variables apply to every OpenTelemetry exporter in the process. If another backend shares the process, setting them for Kubit sends that backend’s spans to Kubit too.
Check the connection with curl
This request sends one span as OTLP/JSON. It works from any machine, so it separates a key or network problem from a problem in your app:HTTP 200 when Kubit accepted the span. Run it again with a different traceId to send a second test trace.
Verify
Open Agent > Activity in the Kubit app, set Time Range to Last 1 day and click Execute. Thechat.completion trace from your test span is in the list. Validate in Activity shows what to check in the trace.
If it fails
More checks are in Is my data flowing?.
Next steps
- Quickstart: check the extraction mapping and validate in Activity.
- Kubit SDK for Python: the same setup with span filtering and masking built in.