#9543·jaeger

[Bug]: jaeger-anonymizer writes an empty UI trace when --trace-id is not spelled the way TraceID.String() prints it

Author: DsThakurRawatCreated Sep 13, 2026Updated Sep 13, 2026

What happened?

query.QueryTrace parses --trace-id with model.TraceIDFromString, which accepts 1 to 32 hex digits in either case, so an uppercase id, a short id without leading zeros, or a 32-digit zero-padded id all fetch the trace. The captured file stores TraceID.String(), which is lowercase %016x (or %016x%016x). uiconv's extractor then compares the raw flag string against that (cmd/anonymizer/app/uiconv/extractor.go:51, string(span.TraceID) == e.traceID) and keeps only matching spans. Any spelling other than the canonical one gives a run that exits 0, logs "Wrote UI-compatible anonymized file", and produces {"data":[{"traceID":"<as typed>","spans":null,...}]} while .anonymized.json holds every span.

Steps to reproduce

On main (9c5c48fa) with the codec import from #9540 (without it the binary panics earlier, #9539), against ./cmd/jaeger and a two-span tracegen trace:

--trace-id c1cd5a5e3d4218983d1009f8270ad319   exit 0   UI file: 2 spans   .anonymized.json: 2 spans
--trace-id C1CD5A5E3D4218983D1009F8270AD319   exit 0   UI file: 0 spans   .anonymized.json: 2 spans

Unit level, one span with TraceID{High: 0, Low: 123456} written through writer, then uiconv.Extract with each spelling (all four parse to the same TraceID):

"000000000001e240"                 -> 1 span
"1e240"                            -> 0 spans
"00000000000000000000000001e240"   -> 0 spans
"000000000001E240"                 -> 0 spans

Expected behavior

Any spelling the query accepts selects the same spans in the UI file, or the tool rejects the spelling up front instead of after the files are written.

Jaeger backend version

main (9c5c48fa)

Additional context

Fix shape: parse the flag once in main.go, fail fast on a parse error (today a bad id is caught only after the output files are opened), and pass tid.String() to uiconv.Config.TraceID and the output file prefix; a four-spelling table in extractor_test.go. Happy to send it once a slot frees.