Skip to content

Conversation

@mdisibio
Copy link
Contributor

@mdisibio mdisibio commented Sep 16, 2025

What this PR does:
TraceQL metrics has incorrect results when grouping by an attribute with overlapping string and integer values. I.e. rate() by (span.http.status_code) where the data contains 500 (int) and "500" (string). Because we internally down-cast to strings for inserting into SeriesSet maps via promLabels. This fix updates SeriesSet to preserve the types in the map key, and eliminates promLabels entirely (to be sure there are no remaining gaps), and return two distinct time series.

Which issue(s) this PR fixes:
Fixes #5350

Checklist

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

type SeriesMapKey [maxGroupBys]SeriesMapLabel
Copy link
Contributor Author

@mdisibio mdisibio Sep 17, 2025

Choose a reason for hiding this comment

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

This is the core change. SeriesSet changed to use a map key that is comparable and preserves the static type. This is the same approach used in the by() operator itself (GroupingAggregator), but with also the label name.

@mdisibio mdisibio merged commit a2fccc2 into grafana:main Sep 23, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants