Applies to:
- Plan - Any
- Deployment - Any
Summary
Braintrust maps OTel span attributes to structured fields such asinput, output, and metrics. Attribute stripping removes the parsed attributes from metadata to avoid storing duplicate payloads.
- Braintrust-hosted: this option is enabled. Parsed OTel attributes no longer appear in
metadata. - Self-hosted: the option is off by default. There is no change to your data until you opt in.
- Per-span escape hatch: set the
braintrust.otel.preserve_attributesattribute totrueon any span where you need the raw attributes preserved onmetadatafor forensics or debugging.
This mapping and stripping behavior applies to trace spans. OTLP log records keep record attributes in
metadata without GenAI field mapping, so braintrust.otel.preserve_attributes does not control their storage.What changes for Braintrust-hosted customers
For spans ingested via OTel, attribute keys that Braintrust successfully parses into structured fields are removed frommetadata. The data is not lost. It is available on the parsed field (input, output, metrics, scores, expected, tags, span_attributes, or origin).
Examples of attributes that are parsed and therefore stripped:
- Vercel AI SDK:
ai.prompt,ai.prompt.messages,ai.prompt.format,ai.response.text - GenAI:
gen_ai.input.messages,gen_ai.output.messages - OpenInference, including LlamaIndex: parsed message, input, output, token usage, and score attributes. See OpenInference mappings.
- Traceloop, CrewAI, Pydantic AI, LiveKit, and other supported integrations: their parsed attributes are stripped as well.
metadata. For OpenInference feedback, this includes names, labels, explanations, and scores that fail validation.
Escape hatch: preserve raw attributes per span
If you need the raw OTel attributes onmetadata for a specific code path, for example to compare what an upstream library actually emitted against what Braintrust parsed, set the attribute braintrust.otel.preserve_attributes to true on that span. The override is evaluated per-span, so you can scope it to one suspect call without changing the rest of your tracing.
Both the boolean true and the string "true" are accepted.
metadata exactly as before.
Self-hosted: enabling the feature
Self-hosted deployments default to the prior behavior (raw attributes are kept onmetadata). To opt in, set STRIP_OTEL_ATTRIBUTES_FROM_METADATA=true on the api-ts service through your deployment configuration.
The per-span braintrust.otel.preserve_attributes escape hatch works the same way once the env var is enabled.
Verifying the behavior
- Send a known OTel span (for example, a Vercel AI SDK call producing
ai.prompt) to Braintrust. - Open the resulting log row. The parsed payload should appear in
input/output, and the corresponding attribute keys should be absent frommetadata. - Re-run the same call after setting the
braintrust.otel.preserve_attributesattribute totrueon the span. The raw attribute keys should reappear inmetadatawhile still being parsed intoinput/output.