Skip to content

[Bugfix] Fix search by trace:id with short trace ID #5331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ruslan-mikhailov
Copy link
Contributor

@ruslan-mikhailov ruslan-mikhailov commented Jun 27, 2025

What this PR does:
Trace IDs are stored with leading zeros, no need to trim

  1. Fixes search by short trace id in query: {trace_id!="abc"}.
  2. Fixes regression bug for search by link:spanID. The bug was hidden because with bytes.TrimLeft(id, "\x00") results after HexStringToTraceID and HexStringToSpanID were the same

Which issue(s) this PR fixes:
Fixes #4437 and #4967

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@ruslan-mikhailov ruslan-mikhailov force-pushed the bugfix/query-64bit-trace-id branch 2 times, most recently from 0cebcd1 to 0a419f3 Compare June 27, 2025 14:34
})

t.Run(fmt.Sprintf("%s: include span id", v.Version()), func(t *testing.T) {
spanID := "0000000000010203"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to support search with trimmed leading zeros, e.g. {span:id = "10203"} ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added fix in a separate PR: #5343

@ruslan-mikhailov ruslan-mikhailov force-pushed the bugfix/query-64bit-trace-id branch 2 times, most recently from a4a7a1a to 2c3a94a Compare July 1, 2025 09:56
@ruslan-mikhailov ruslan-mikhailov changed the title [Bugfix] Fix search by trace id and span id [Bugfix] Fix search by trace:id with short trace ID Jul 1, 2025
@ruslan-mikhailov ruslan-mikhailov marked this pull request as ready for review July 1, 2025 10:20
Copy link
Contributor

@mapno mapno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ruslan-mikhailov ruslan-mikhailov force-pushed the bugfix/query-64bit-trace-id branch from 2c3a94a to 7f81273 Compare July 11, 2025 08:30
@ruslan-mikhailov ruslan-mikhailov force-pushed the bugfix/query-64bit-trace-id branch from 7f81273 to 32858f9 Compare July 11, 2025 08:32
@ruslan-mikhailov
Copy link
Contributor Author

+ rebase from latest main to resolve conflicts

@ruslan-mikhailov ruslan-mikhailov merged commit 82afab5 into grafana:main Jul 11, 2025
37 of 38 checks passed
knylander-grafana pushed a commit to knylander-grafana/tempo-doc-work that referenced this pull request Jul 18, 2025
* search tests refactoring

* search tests refactoring

* search test refactoring: trace id input param

* Tests for search by trace:id and span:id

* [bugfix] Correct filtration by trace:id

* make gen-parquet-query

* Minor optimisation

* [bugfix] fix regression bug for search by link:spanID

* Search tests: find all traces case

* Mute gosec linter for tests

* Changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Traces with 64 bit IDs cannot be queried by trace:id
2 participants