OTEL Trace Ingestion
Publish OTEL Traces directly to your DBNL Deployment
OpenTellemetry (OTEL) Trace Ingestion allows for the richest data to be uploaded to your Project, but requires some off-platform coding and does not support backfilling data.
OTEL Trace Ingestion needs to be enabled during Deployment so that the required Clickhouse database is provisioned and initialized.
The following fields are required regardless of which ingestion method you are using:
input
: The text input to the LLM as astring
.output
: The text response from the LLM as astring
.timestamp
: The UTC timecode associated with the LLM call as atimestamptz
.
Example Trace Publishing Code
Embed the following code into your production AI product wherever you would normally capture traces. For more examples see the OpenTelemetry docs.
from opentelemetry import trace as trace_api
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.sdk.trace.export import BatchSpanProcessor
tracer_provider = trace_sdk.TracerProvider()
trace_api.set_tracer_provider(tracer_provider)
tracer_provider.add_span_processor(
BatchSpanProcessor(
OTLPSpanExporter(
endpoint="https://api.dev.dbnl.com/otel/v1/traces",
headers={
"Authorization": "Bearer API_TOKEN",
"x-dbnl-project-id": "PROJECT_ID",
},
)
)
)
Was this helpful?