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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dbnl.com/v0.26.x/configuration/data-connections/otel-trace-ingestion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
