> For the complete documentation index, see [llms.txt](https://docs.dbnl.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dbnl.com/v0.26.x/configuration/data-connections/otel-trace-ingestion.md).

# OTEL Trace Ingestion

[OpenTellemetry](https://opentelemetry.io/docs/what-is-opentelemetry/) (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.

{% hint style="warning" %}
OTEL Trace Ingestion needs to be enabled during [Deployment](/v0.26.x/platform/deployment.md) so that the required Clickhouse database is provisioned and initialized.
{% endhint %}

The following fields are required regardless of which ingestion method you are using:

* `input`: The text input to the LLM as a `string`.
* `output`: The text response from the LLM as a `string`.
* `timestamp`: The UTC timecode associated with the LLM call as a `timestamptz`.

{% hint style="info" %}
See the [DBNL Semantic Convention](/v0.26.x/configuration/dbnl-semantic-convention.md) for other semantically recognized fields. Using these naming conventions will allow DBNL to map semantic meaning to those columns and provide better [Dashboards](/v0.26.x/workflow/dashboards.md) and [Insights](/v0.26.x/workflow/insights.md).
{% endhint %}

## 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](https://opentelemetry.io/docs/languages/python/getting-started/).

```python
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",
            },
        )
    )
)
```
