# Application spans over OTLP

**Last updated:** 2026-11-26T05:17:10-03:00 (UTC-3)

[Observability](/docs/features/observability/) · [Traces and the span store](/docs/features/traces/) · [Trace explorer](/docs/features/trace-explorer/) · [Public trace API](/docs/features/public-trace-api/) · [Content capture](/docs/features/content-capture/)

The gateway already records its own spans for every request: routing, provider attempts, cache, guardrails, tools. Your application knows the rest of the story: which agent ran, which tool it called, which model call the answer came from. With `otlp_ingest` your application sends its own OpenTelemetry spans to the gateway, and both halves become **one trace**: the agent at the top, its tools and model calls under it, and under each model call that went through the gateway, the gateway's request with its routing decision and provider attempts.

Nothing gateway-specific is installed in the application. Any OpenTelemetry SDK exports to the gateway with the standard OTLP/HTTP exporter and a gateway key.

## Turn it on

1. Turn on the span store and the ingest (operator controls, off by default):

   ```yaml
   features:
     span_store: true    # the gateway's own spans; required
     otlp_ingest: true   # POST /v1/traces accepts application spans
   ```

   Both can also be switched in **Settings → Features** or with `PUT /api/v1/admin/features/otlp_ingest`, with no restart.

2. Create a key for the application's exporter with **only** the scope `traces:write`, on the team the application belongs to (`scopes` on `POST /api/v1/admin/keys`, or the key form in the console). A key without a team is refused: spans always belong to a team, and the gateway never creates one.

3. Point the exporter at the gateway:

   ```bash
   export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://gateway.example.com/v1/traces
   export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer <key with traces:write>"
   export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf   # or http/json
   ```

4. Call the gateway from inside the span that makes the model call, so the request carries the `traceparent` of that span. Most HTTP instrumentation does this already; with `spans.caller_trace: join` (the default) the gateway continues the application's trace.

No other header is needed. The endpoint is the standard OTLP path, so `OTEL_EXPORTER_OTLP_ENDPOINT=https://gateway.example.com` also works.

### A complete example (Python, standard OpenTelemetry SDK)

```python
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.propagate import inject
import requests

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))  # reads the OTEL_* variables above
trace.set_tracer_provider(provider)
tracer = trace.get_tracer("support-agent")

with tracer.start_as_current_span("agent.run", attributes={"gen_ai.operation.name": "invoke_agent", "gen_ai.agent.name": "support", "gen_ai.conversation.id": "c-1042"}):
    with tracer.start_as_current_span("lookup_order", attributes={"gen_ai.operation.name": "execute_tool", "gen_ai.tool.name": "lookup_order", "gen_ai.tool.call.id": "call_1"}):
        pass  # your tool
    with tracer.start_as_current_span("chat support-model", attributes={"gen_ai.operation.name": "chat", "gen_ai.request.model": "support-model"}) as span:
        headers = {"Authorization": "Bearer <inference key>"}
        inject(headers)  # traceparent of the chat span
        r = requests.post("https://gateway.example.com/v1/chat/completions", headers=headers,
                          json={"model": "support-model", "messages": [{"role": "user", "content": "Where is my order?"}]})
        usage = r.json()["usage"]
        span.set_attribute("gen_ai.usage.input_tokens", usage["prompt_tokens"])
        span.set_attribute("gen_ai.usage.output_tokens", usage["completion_tokens"])
provider.shutdown()
```

The trace view then shows `agent.run` → `lookup_order` and `chat support-model`, and under the chat span the gateway's `POST /v1/chat/completions` request with its routing and provider attempt spans. The same works with the Node.js SDK (`@opentelemetry/exporter-trace-otlp-proto`), with any framework that emits OpenTelemetry GenAI or OpenInference spans, and with another gateway or proxy in front of this one, as long as it continues `traceparent`.

### Send spans with curl

```bash
curl -sS https://gateway.example.com/v1/traces \
  -H "Authorization: Bearer <key with traces:write>" \
  -H "Content-Type: application/json" \
  -d '{"resourceSpans":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"shop"}}]},
       "scopeSpans":[{"scope":{"name":"shop-agent"},"spans":[{
         "traceId":"4bf92f3577b34da6a3ce929d0e0e4736","spanId":"00f067aa0ba902b9","name":"chat gpt-4o-mini",
         "startTimeUnixNano":"1795615331000000000","endTimeUnixNano":"1795615332400000000",
         "attributes":[{"key":"gen_ai.operation.name","value":{"stringValue":"chat"}},
                       {"key":"gen_ai.request.model","value":{"stringValue":"gpt-4o-mini"}},
                       {"key":"gen_ai.usage.input_tokens","value":{"intValue":"120"}},
                       {"key":"gen_ai.usage.output_tokens","value":{"intValue":"30"}}]}]}]}]}'
```

The answer is OTLP's own, in the encoding of the upload: `{}` (JSON) or an empty body (protobuf) when every span was stored, otherwise a partial success that counts the spans left out and says why:

```json
{"partialSuccess": {"rejectedSpans": "2", "errorMessage": "Spans not stored: 1 invalid_id (unusable trace or span IDs); 1 non_genai (no GenAI attributes and no GenAI span below them)"}}
```

The write is synchronous: a `200` means the spans are stored and readable at once, without waiting for the span writer's flush.

## Formats

| What | Accepted |
| --- | --- |
| Encoding | `application/x-protobuf` (an OTLP `ExportTraceServiceRequest`) or `application/json` (OTLP/HTTP JSON) |
| Compression | `Content-Encoding: gzip`, or none |
| IDs in JSON | Hex, as the OTLP JSON rule says, or base64, as a generic protobuf-to-JSON encoder writes them. Both are stored as the same lowercase hex. |
| Enums in JSON | Numbers or names (`SPAN_KIND_CLIENT`, `STATUS_CODE_ERROR`) |
| Signals | Traces only. `POST /v1/logs` and `POST /v1/metrics` answer `404`: the gateway does not store application logs or metrics. Link your log backend from the trace view with `spans.log_link_template`. |

## What is kept

**Dialects.** The gateway maps two attribute dialects in full: the OpenTelemetry GenAI semantic conventions (1.37 and later; `gen_ai.*`) and OpenInference (`openinference.span.kind`, `llm.*`). A span typed only by another SDK's type attribute (a key ending in `.observation.type`, `.span.kind`, `.span.type`, `.span_type` or `.spantype`) is typed by that attribute's value, from a fixed table, and the attribute is kept as `dialect_type`:

| Value | Sub-kind |
| --- | --- |
| `generation`, `llm` | `llm` |
| `embedding` | `embedding` |
| `agent` | `agent` |
| `tool` | `tool` |
| `chain`, `workflow` | `workflow` |
| `retriever` | `retrieval` |
| `guardrail` | `guardrail` |
| `evaluator` | `evaluator` |
| `task`, `span`, `event` | `task` |

Any other value keeps the span as sub-kind `untyped`, with the issue `unsupported_dialect`; it is never typed by a guess.

**Sub-kinds.** Every stored application span has kind `app` (filter with `span.kind:app`) and one of these sub-kinds (`span.subkind`):

| Sub-kind | From `gen_ai.operation.name` | From `openinference.span.kind` |
| --- | --- | --- |
| `agent` | `invoke_agent`, `create_agent` | `AGENT` |
| `workflow` | `invoke_workflow`, `rerank` | `CHAIN`, `RERANKER` |
| `llm` | `chat`, `text_completion`, `generate_content` | `LLM` |
| `embedding` | `embeddings` | `EMBEDDING` |
| `tool` | `execute_tool` | `TOOL` |
| `retrieval` | `retrieval` | `RETRIEVER` |
| `guardrail` | — | `GUARDRAIL` |
| `evaluator` | — | `EVALUATOR` |
| `task` | any other operation (issue `unknown_operation`), or `gen_ai.*` attributes without an operation | any other kind |
| `untyped` | — | — (a span typed only by another dialect, with a value outside the table above) |
| `connector` | a span with no GenAI attributes that connects GenAI spans (below) | |

**Connectors.** With `otlp_ingest.keep: genai_and_ancestors` (the default) a span without GenAI attributes is kept when a GenAI span of the same upload is below it, or when a gateway span already stored names it as its parent, or when it is an outgoing call (span kind `client`, such as the HTTP call an agent framework makes) below a GenAI span of the same upload: the gateway writes its own request span on its own clock, often after the application exported, and that span names the call as its parent. So the tree keeps its root (an `http.request` span above two parallel chat calls stays one trace with one root). It is stored as sub-kind `connector` with its name, times and status and no attributes. Any other non-GenAI span is left out and counted as `non_genai` in the partial success. With `keep: genai` only GenAI spans are kept.

**Columns and attributes.** Read from a span, by the first attribute present:

| Stored as | Read from |
| --- | --- |
| Trace, span and parent IDs | the span's own (W3C hex) |
| Name, times (µs), status | the span's name (printable, at most 200 bytes), start and end, status code (`error` for `STATUS_CODE_ERROR`); `http.response.status_code` as the HTTP status |
| Model | `gen_ai.response.model`, else `gen_ai.request.model`, `llm.model_name`, `embedding.model_name` (identifiers only); both are also kept as `response_model` and `request_model` |
| Provider | `gen_ai.provider.name`, else `gen_ai.system`, `llm.provider`, `llm.system` |
| Tokens | `gen_ai.usage.input_tokens` / `output_tokens` (also `prompt_tokens` / `completion_tokens`, `llm.token_count.prompt` / `completion`), cache read and creation, reasoning. Integers only: anything else is stored as unknown, never zero, with the issue `invalid_tokens` |
| Session | `gen_ai.conversation.id`, else `session.id`, on the span or its nearest ancestor in the upload (an exporter that sets it on the root only still puts every span in the session). Marked `session_declared`: the application asserted it |
| End user | `user.id`, else `enduser.id`, inherited the same way |
| Agent | `gen_ai.agent.name` (and `agent_id`) |
| Tool | `gen_ai.tool.name` and `gen_ai.tool.call.id`, kept as the attributes `tool` and `call_id`: structure, shown only to readers with `content_structure:read`. A tool span is named `execute_tool`, whatever the application named it, since the conventional name carries the tool's name |
| Error | `error.type` as the error code; an `exception` event keeps its `exception.type`, never its message or stack |
| Prompt | `gateway.prompt.id` and `gateway.prompt.version`, as `prompt_id` and `prompt_revision` with `prompt_source: declared` (filter with `prompt.id:<id>`) |
| Tags | `gateway.tags`, else another SDK's tags (a key `<sdk>.tags` or `<sdk>.trace.tags`, the first by name): a map of string values, or an array of names (stored as `true`), sent as the OTLP value or written as a JSON string. Anything else: issue `tags_malformed`, naming the key |
| Retrieval documents | `retrieval.documents.<n>.document.id` and `.score`, at most 16, never the document text |
| Request parameters | `gen_ai.request.temperature`, `top_p`, `max_tokens`, `frequency_penalty`, `presence_penalty`, `seed`, `choice.count` |
| Where it came from | `service` (`service.name`), `service_version`, `scope` and `scope_version` (instrumentation scope), `sdk` (`telemetry.sdk.*`), and the key that sent it |
| Events, links | at most 16 events (name and time) and 8 links |

Any other `gen_ai.*` attribute is kept under `extra` when its value is a number, a boolean or an identifier (letters, digits and `_ - . : /`), cut to 64 characters with a `…[truncated]` mark, and its name does not suggest written text (`message`, `prompt`, `completion`, `content`, `explanation`, `description`, `instruction`, `input`, `output`, `argument`, `result`, `text`, `document`, `query`, `tool`, `reason`, `name`, `system`); at most 16. Any other attribute is not stored: it is counted in `dropped_attributes` and the first eight names are listed in the issue `attributes_dropped`. The attributes fit `spans.max_attribute_bytes` (2 KiB by default); what does not fit is dropped in a fixed order and marked `attributes_truncated`. Issues are kept whole beside them.

## Content

Message content never becomes an attribute. `gen_ai.input.messages`, `gen_ai.output.messages`, `gen_ai.system_instructions`, tool arguments and results, `input.value` / `output.value` and the OpenInference message and document attributes are:

- **stored, encrypted**, in the content store when the team's [content capture policy](/docs/features/content-capture/) has the purpose `app_spans` (with `content_capture` and `content_capture_evaluation` on and a content encryption key). The policy's `keys`, `models`, `capture` (request, response or both) and `sample_rate` apply as they do to requests; the record is written once the span is stored, under an ID derived from the team, trace and span. A policy with `app_spans` alone captures no inference request. The messages are normalized to `{"messages":[{"role","content"}]}`: the GenAI parts form (`{role, parts:[{type:"text", content}]}`) becomes text, other parts keep their type. The record is named `otlp.<trace_id>.<span_id>`, has the operation `app_span` and the purpose `app_spans`, and follows the policy's retention and reader grants; the span says `content: captured` and names it;
- **discarded** otherwise: the span says `content: not_captured` and carries the issue `content_not_captured`.

```yaml
content_capture:
  policies:
    - team: support
      purposes: [audit, app_spans]   # app_spans: keep ingested application messages
      retention_days: 14
```

**Judges.** A judge or code evaluator reads an application span's content only when the team's policy has **both** `app_spans` and `evaluation` (the policy's `evaluation` limits, models, operation `app_span` and rate, apply too). The record then also keeps a **sent view**: the normalized messages and the answer's text, every string they carry masked (a text part beside an image, a tool call's arguments included) by the local guardrails in effect for the team, key and model (every mask or block guardrail without a provider, at any stage; a monitor never changes text). Judges read that view only, never the messages as received; the received view keeps the messages as sent (`raw`, by attribute) beside the normalized ones, for readers with the content capture reveal grant, when both fit `max_bytes` (otherwise the normalized messages alone, whole). A span whose input or answer is missing or longer than `max_bytes` is not judgeable.

| Policy purposes | Span-scope judge | Trace-scope judge (no gateway request in the trace) |
| --- | --- | --- |
| no `app_spans` | `content_not_captured` | `content_not_captured` |
| `app_spans` only | `content_not_captured` (not kept for evaluation) | same |
| `app_spans` and `evaluation` | the span's masked messages and answer | the first captured `llm` or `agent` span's messages, the last one's answer |

A judge reads only its own team's records, as for gateway requests. When a trace holds a gateway request, a trace-scope judge reads the gateway's captured requests, as before.

```yaml
content_capture:
  policies:
    - team: support
      purposes: [app_spans, evaluation]   # judges may read the masked sent view
guardrails:
  - id: mask-mail
    mode: mask
    detectors: [email]                    # masks addresses in what judges read
```

## Cost

An application model span (`llm` or `embedding`) carries its own cost, with `cost_source` saying where it came from:

- `declared`: a cost the application sent (`gen_ai.usage.cost`, `gen_ai.usage.cost.amount` or `llm.cost.total`, in US dollars), also kept as `declared_cost_usd`;
- `price_book_estimate`: without one, the gateway's price book applied to its tokens, by its model as a gateway alias, else by a price book entry with that model ID; also kept as `estimated_cost_usd`. Every token count the price applies to must be known (input and output for a model call, input for embeddings);
- `unknown`: neither, or no price (issue `model_not_priced`). Never zero.

**Counted once.** A model call that went through the gateway is also the gateway's request span, which the ledger already valued. So an application model span's cost enters trace and session totals only when no gateway request span served that call, that is, when no request span of the same team and trace names it as its parent, directly or through `connector` spans (the HTTP call an agent framework makes between its model span and the gateway). When one does, the ledger's cost counts: the span's cost column reads `none`, so no span list, chart or total adds the call twice, and the span shows both values in its attributes: `declared_cost_usd` or `estimated_cost_usd`, `cost_counted: ledger`, `served_by_request`, `ledger_cost_usd` and `cost_note`. A declared cost that disagrees with the ledger loses: the ledger is what the provider billed through the gateway. An unserved span says `cost_counted: span`.

| Case | Span shows | Totals count |
| --- | --- | --- |
| The application called a model directly, declared US$ 0.50 | `cost_source: declared`, US$ 0.50 | US$ 0.50 |
| The application called the gateway; its request cost US$ 0.001 | the span's own cost and `ledger_cost_usd: 0.001` | US$ 0.001, once |
| Same, but the application declared US$ 0.50 | both values, with `cost_note` | US$ 0.001 (the ledger wins) |

**Whatever the arrival order.** An application span stored after its gateway request is matched as it is uploaded. A gateway request stored after its application span (the usual order: the gateway writes its spans on its own clock) takes that span's call, cost and tokens out of the trace summary as it is written, in the same transaction, on both span engines, and marks the span served. Uploads and the gateway's writes of the same trace hold one lock per trace, so neither misses the other. A second request under the same span takes nothing out again. The call leaves the trace's call count only against a model attempt the request made (a cache hit or a refusal makes none). When an upload holds a trace past the 5-second lock timeout, the gateway writes its batch anyway, corrected from what is committed, and logs `span_store_trace_lock_timeout`; a summary rebuild (`POST /api/v1/admin/traces/summaries/rebuild`) always counts exactly once. When the application's cost was known and the gateway's ledger has none (an unpriced model), the summary keeps cost state `partial`.

The trace read returns `app_totals`: the tokens and cost (`cost_usd`, `cost_state`) of the application's model spans that the gateway did **not** serve, and how many it did serve. An embeddings span with 8 input tokens and no output reads input 8, output unknown, total 8.

## Instrumentation issues

A problem with a span never drops the span: it is stored with its issues, each with the attribute, what it costs and how to fix it. The span panel of the trace view lists them, with a copyable prompt for a coding agent; filter with `issue:<code>` (`issue:*` for any). The same table is returned by `GET /api/v1/admin/otlp-ingest/settings` (`issue_codes`), and a test keeps this page equal to it.

| Code | Attribute | Effect | Fix |
| --- | --- | --- | --- |
| `missing_model` | `gen_ai.request.model` | The span has no model: its cost cannot be estimated and model facets leave it out | Set `gen_ai.request.model` (and `gen_ai.response.model`) on model and embedding spans |
| `invalid_tokens` | `gen_ai.usage.input_tokens` | The token count is stored as unknown, never as zero, and the cost is unknown | Send token counts as non-negative integers (`intValue`), not strings |
| `model_not_priced` | `gen_ai.response.model` | No price of the gateway's price book matches the model: the cost is unknown | Use a model alias of the gateway, or price the model in the price book |
| `input_malformed` | `gen_ai.input.messages` | The input messages are not a JSON array of messages: nothing is stored or shown as a chat, and evaluators that read structured input skip the span | Send a JSON array of `{role, parts}` or `{role, content}` objects |
| `output_malformed` | `gen_ai.output.messages` | The output messages are not a JSON array of messages | As above |
| `tags_malformed` | `gateway.tags` | The tags were not read | Send a map of string values or an array of strings, as the OTLP value or as a JSON string |
| `invalid_session` | `gen_ai.conversation.id` | The session ID is not usable: the span is in no session | Send 1 to 128 printable characters |
| `unknown_operation` | `gen_ai.operation.name` | The operation is not one the gateway maps: the span is typed `task` | Use one of the operations in the table above |
| `unsupported_dialect` | — | The span is typed by another dialect's attribute with a value outside the gateway's table | Add `gen_ai.operation.name` or `openinference.span.kind` |
| `attributes_dropped` | — | Attributes outside the allowlist were not stored | Nothing to fix unless you need one: `gen_ai.*` attributes are kept |
| `content_not_captured` | — | The span carried content and the team's policy has no `app_spans` purpose: it was discarded | Add the `app_spans` purpose to the team's policy |

The attribute column names the attribute the issue is about; `invalid_tokens` names the token attribute that was wrong.

## Settings

The `otlp_ingest` block is the base of a runtime policy. The **OTLP ingest** panel on the **Logs** page of the console (beside the **Span store** panel, `config:read`), or `PUT /api/v1/admin/otlp-ingest/settings`, replaces it as a whole (audited as `otlp_ingest.set`); `DELETE /api/v1/admin/otlp-ingest/settings` with the version returns to the YAML (audited as `otlp_ingest.revert`). `GET /api/v1/admin/otlp-ingest/settings` shows the policy in force, the source of each value and the issue codes. It applies from the next upload.

```yaml
otlp_ingest:
  max_request_bytes: 4194304     # 1024-33554432; also what a gzip body expands to
  max_spans_per_request: 1000    # 1-10000
  max_traces_per_request: 64     # 1-1000
  max_concurrent_uploads: 8      # 1-256, per replica
  keep: genai_and_ancestors      # genai | genai_and_ancestors
```

| Setting | Default | Bounds | Past it |
| --- | --- | --- | --- |
| `max_request_bytes` | `4194304` (4 MiB) | 1024 to 33554432 | `413 request_too_large`, nothing stored |
| `max_spans_per_request` | `1000` | 1 to 10000 | `413 too_many_spans`, nothing stored. Counted while the body is decoded, so a body full of empty spans stops at the bound |
| `max_traces_per_request` | `64` | 1 to 1000 | `413 too_many_traces`, nothing stored |
| `max_concurrent_uploads` | `8` | 1 to 256 | `503 ingest_busy` with `Retry-After: 1`; OTLP exporters retry it |
| `keep` | `genai_and_ancestors` | `genai`, `genai_and_ancestors` | — |

Other bounds that apply, while the body is decoded: at most 128 attributes, 32 events and 16 links per span and 64 items per array or map value (the rest is skipped), nesting four levels deep, and 256 values per span on average for the whole upload (past it `413 too_many_values`, nothing stored). After decoding: a span must start within `spans.retention_days` and at most 5 minutes ahead (`out_of_window`); its duration is capped at 24 hours; a trace holds at most `spans.max_spans_per_trace` spans (`trace_full`). With `rate_limits` on, every upload counts as one request in the key's, team's, organization's and end user's requests-per-minute policies, the same counters as inference; past one it answers `429 rate_limit_exceeded` with `Retry-After` before the body is read.

Recommended: keep the defaults, and set the exporter's batch size (`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`, 512 by default) below `max_spans_per_request`. The measured cost of an upload on each span engine is in [performance](/docs/performance/otlp-ingest/).

## Answers

In the order they are checked: `401` without a valid key; `403 scope_forbidden` without `traces:write`; `404 feature_disabled` without `span_store` (only to a key that holds the scope); `403 team_required` for a key without a team; `429` past a rate policy; `503 ingest_busy`; `415` for another media type or encoding; `413` past a bound; `400 invalid_request` for a body that is not an OTLP trace export; `503 storage_unavailable` when the spans could not be stored (nothing was; send them again).

## Joining the gateway's trace

- **`spans.caller_trace: join`** (default): the gateway continues the application's trace ID, and its request span's parent is the application span that made the call. Late spans merge: an application exports its root after its children, and a batch sent minutes later lands under the right parent. A judge run is never mixed in: it lives in its own trace, linked to the trace it judged, so a late judge span does not stretch the application's totals.
- **`spans.caller_trace: link`**: the gateway mints its own trace ID and keeps the application's apart (`caller_trace_id`) with a `caller` link. The application's spans stay in the application's trace; the gateway's request trace links to it, and the application trace is found by its own ID.

## Security and isolation

- **Identity comes from the key.** Team, organization, key and principal are the authenticated key's. Nothing in the upload names a team; a key without one is refused.
- **Teams never see each other's spans.** Every read filters by team (and by the team's current organization) before it builds a tree, counts or pages. A key of another team that uploads spans under your trace ID adds spans only its own team sees; yours are untouched.
- **An ingest key cannot read.** `traces:write` writes only: every read of traces, results and evaluators answers `403` to it. Give it only to exporters.
- **No content in attributes**, no names copied into anything but the span name, identifiers checked before they become columns.
- A span sent twice (an exporter's retry) is stored once.

## Agent transcripts

The same route also serves the [agent transcript ingest](/docs/features/agent-recognition/#transcript-ingest). With `otlp_ingest` off it is the only ingest, as before. With `otlp_ingest` on, an upload is a transcript when it carries the header `X-Gateway-Ingest: transcript`; set it in the transcript plugin's exporter headers when you turn `otlp_ingest` on.

## Upgrade notes

Migrations 295 to 297 add the policy override and the result retention state, let a content record have the `app_spans` purpose (a constraint replaced without scanning existing rows), and key the retained copy of annotated traces by team as well (two teams may now hold the same trace and span ID). On the analytics store the retained copy moves to `gateway_spans_retained_v2`, filled once from `_v1`. With `otlp_ingest` off nothing changes. Spans are stored in the engine `spans.engine` selects, PostgreSQL or the analytics store; issues live in the span's attributes, so neither engine's span table changes.
