fix(datadog metrics sink): fix metric type comparison using wrong operand in sort#25621
fix(datadog metrics sink): fix metric type comparison using wrong operand in sort#25621gwenaskell wants to merge 4 commits into
Conversation
pront
left a comment
There was a problem hiding this comment.
Good catch! Please add a changelog entry.
@gwenaskell Please clarify. If the unit tests did cover this typo, it should have been failing to start with, so it would seem this code path is not actually covered. |
bruceg
left a comment
There was a problem hiding this comment.
The fix looks correct but it needs a coverage test and changelog entry.
|
@bruceg @pront This fix should have a very limited functional impact that will probably go unnoticed, because the current logic already sorts by metric name and tags which is the most important thing for optimizing compression. the only difference this will make is that a set of metrics (type, name) previously sorted as Added a unit test and a changelog. |
Summary
In
sort_and_collapse_counters_by_series_and_timestamp, the second tuple of the.cmp()call was incorrectly usinga.value().as_name()instead ofb.value().as_name(). This caused the metric type name (counter/gauge/histogram) to always compare equal to itself, making it a no-op as a sort key. The sort was effectively only ordering byseries()andtimestamp(), not by metric type name as intended.Vector configuration
No configuration change — this is an internal sink implementation fix.
How did you test this PR?
Added a unit test.
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Made with Cursor