Skip to main content
Applies to:
  • Plan -
  • Deployment - Hosted and BYOC
  • Use case - How to route OTLP spans to experiments/rows using braintrust.parent vs x-bt-parent when using a shared collector (BYOC and hosted)

Summary

OTLP spans sent to /otel/v1/traces through a shared collector are routed using either a per-span braintrust.parent attribute or the x-bt-parent request header.

What is happening

When you send OTLP traces to /otel/v1/traces through a shared collector, Braintrust uses each span’s braintrust.parent attribute to determine where the span is routed. For spans without that attribute, Braintrust uses the x-bt-parent header supplied with that request.

Fix or suggestion

  1. Set braintrust.parent on every span you emit, including child spans.
  2. Use the intended experiment row span’s exported parent value as the attribute value.
OTLP attribute fragment:

Option 2: Per-request header (alternative)

The x-bt-parent header is a request-wide default. Use this option only for requests containing spans for a single experiment row. For requests containing spans for multiple experiment rows, set braintrust.parent on every span, including child spans.
  1. For spans without braintrust.parent, set the request’s x-bt-parent header to the intended experiment row span’s exported parent value.

Verify routing

  • Send a test trace using the intended row span’s exported parent value and verify that it appears beneath that row.
The API key used by the collector must have write access to every destination you route spans to.