Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

OpenInference

cetra reads spans from the OpenInference instrumentation libraries, so you can use them with their own OpenTelemetry exporter.

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 OpenAIInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from 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.

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, GUARDRAIL or EVALUATOR becomes the cetra span kind of the same name.
  • The captured fixtures are Python. The TypeScript helpers of @cetra-ai/sdk use the OpenInference libraries for OpenAI, Anthropic and LangChain, and are covered by SDK tests.
  • The versions covered are in each fixture’s case.json.