[Query-frontend] Fix metrics streaming#4624
Conversation
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
I've had issues with this in Grafana but was generating my own string based on the Labels map, so had to sort it before generating the string. As long as the |
mdisibio
left a comment
There was a problem hiding this comment.
Looking good to me. Good approach for diffing the sorted slices. Using prom labels is ok, internally it is the key in the SeriesSet and used for other combine/compare operations like here. If there is an issue with it, would rather have the consistent usage that can all be fixed together than try something different here.
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
7cb024b to
03619c7
Compare
Signed-off-by: Joe Elliott <number101010@gmail.com>
What this PR does:
Metrics diff streaming relied on using the start/end timestamps of input series and labels to determine which output series were impacted. In hindsight is quite obvious that this will only work in the most trivial of examples. Consider a metrics quantile stream: The input series are all labeled like histograms, but the output series are labeled like quantiles.
The engine can technically calculate which output series are impacted by which input series, but this would be increasingly complicated as we added additional metrics function. It would also be quite brittle and require constant upkeep for every function. Instead we have settled on doing a simple diff in the frontend between the previous metrics and the current one.
Notes for the reviewer:
I am currently using prom label string equality to match previous and current series. I believe this works, but looking for confirmation from someone with more experience.
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]