Applies to:
- Plan -
- Deployment -
Summary
Symptom: a single 16-byte trace ID appears as two trace trees in the UI.Cause: two emitters send the same bytes encoded as different strings (hex vs dashed UUID). Braintrust groups traces by exact
root_span_id string equality.Recommended fix: canonicalize
root_span_id at the emitter(s) so all components send the same string form.
What is happening
Braintrust treatsroot_span_id as an opaque string. There is no server-side byte-level canonicalization.If one emitter sends
00112233445566778899aabbccddeeff and another sends 00112233-4455-6677-8899-aabbccddeeff the platform sees two different root_span_id values.Both values represent the same 16 bytes, but they are different strings, so traces split into separate trees.
Fix or suggestion
Option 1: canonicalize at the emitter (recommended)
Pick one canonical string form (common choices below) and enforce it in every emitter or plugin.- Choice A — dashed UUID (example):
00112233-4455-6677-8899-aabbccddeeff - Choice B — 32-char hex (no dashes, common OTel span format):
00112233445566778899aabbccddeeff
- Choose the canonical form for your service boundary.
- Update each emitter/plugin to convert incoming root/span id bytes or strings to that form before emitting.
- Add a unit test or runtime assertion to fail if an emitter would emit a non-canonical form.
- Roll out changes and monitor for split traces.
Option 2: normalize in a shared plugin or preprocessor
If one component is widely reused, normalize there so callers do not need changes. Actionable steps:- Update the shared plugin to accept incoming bytes/hex and emit the chosen canonical string.
- Add backward-compatible parsing for both forms (strip dashes or parse UUID) when reading inbound ids.
- Deploy the plugin carefully, and run tests across services that use it to check for compatibility/regressions.
How to confirm it worked
- Log-based check: for a known trace_id, confirm there is exactly one root_span_id string.
Example:
Expect a single unique value.
- UI check: the trace with that trace_id appears as one tree (no duplicate root spans).
Notes
- Braintrust groups traces by exact root_span_id string equality; choose and enforce one encoding across emitters.
- Common practice: use the format already dominant in your environment (OTel default is 32-char hex for span IDs; some tools prefer dashed UUIDs).