When to use direct ingestion
- Custom spans for non-LLM operations — data preprocessing, post-processing, or any application logic you want visible alongside LLM calls.
- Enriching gateway traces with application-side timing — capture your full RAG pipeline end to end, including database queries and retrieval steps.
- Agent lifecycle spans — operations like
create_agentor session management that are better emitted from your client than from the gateway.
Prerequisites
- A to11 API key with
otel:writescope. - An OpenTelemetry SDK in your language of choice.
Exchange an API key for a collector token
Direct ingestion authenticates with a short-lived token. Exchange your API key for one before configuring your SDK:projectId is the project the token is scoped to. to11 binds every ingested span to this project, so you do not pass it explicitly when sending spans.
If your API key is org-scoped rather than project-scoped, include requestedProjectId in the request body to select the target project. The token is rejected if the key is not authorized for that project.
Tokens expire after 15 minutes. Refresh by calling the exchange endpoint again before expiry.
Configure your OTel SDK
to11 accepts OTLP on two public endpoints:| Protocol | Endpoint |
|---|---|
| gRPC | collector.to11.ai:443 |
| HTTP | https://collector.to11.ai/v1/traces |
You do not set
project.id yourself. to11 binds the spans to your project automatically — the project the token was issued for — and overwrites any value you send.Send spans
Correlate with gateway traces
To place your custom spans in the same trace as gateway LLM calls, propagate the W3Ctraceparent header. See Distributed Tracing for details.