OpenInference
cetra reads spans from the OpenInference instrumentation libraries, so you can use them with their own OpenTelemetry exporter.
Point the exporter at cetra
Section titled “Point the exporter at cetra”The cetra-sdk instrument option already uses these libraries. To use them with your own OpenTelemetry setup, add an exporter that sends to cetra and pass its provider to the instrumentor. This is the setup the fixtures were captured with, with the endpoint and the key changed.
from openinference.instrumentation.openai import OpenAIInstrumentorfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporterfrom opentelemetry.sdk.trace import TracerProviderfrom opentelemetry.sdk.trace.export import BatchSpanProcessor
provider = TracerProvider()provider.add_span_processor( BatchSpanProcessor( OTLPSpanExporter( endpoint="http://localhost:8080/v1/traces", headers={"Authorization": "Bearer <SK_CETRA_KEY>"}, ) ))OpenAIInstrumentor().instrument(tracer_provider=provider)Replace <SK_CETRA_KEY> with your sk-cetra- API key. See Send OpenTelemetry for the endpoint, the ports and the other languages.
What carries over
Section titled “What carries over”cetra reads these OpenInference attributes: the span kind, the model and provider, the flattened input and output messages, the tool definitions, token counts including cache and reasoning tokens, and cost. See Span attributes.
- Retriever documents become the span’s output.
- Embedding vectors are dropped. Their texts are kept.
- A value of
__REDACTED__, which OpenInference writes for hidden content, is treated as content that was not captured. - A span of kind
LLM,EMBEDDING,TOOL,AGENT,CHAIN,RETRIEVER,RERANKER,GUARDRAILorEVALUATORbecomes the cetra span kind of the same name.
Limits
Section titled “Limits”- The captured fixtures are Python. The TypeScript helpers of
@cetra-ai/sdkuse the OpenInference libraries for OpenAI, Anthropic and LangChain, and are covered by SDK tests. - The versions covered are in each fixture’s
case.json.
- Traces: read the trace as a tree and a timeline.
- Cost and tokens: how cost is computed from the token counts.
- Online rules: score these traces automatically.