Closed bartekpokerbartek closed 3 years ago
This seems not to be related to carbon but to graphite, so it would be better to ask at graphite-web.
Anyway I was interested in this problem and proved that it is possible:
The details may vary, depending on your setup, metrics, value distribution and requirements, but here's what I've done:
Let's assume three series with the pattern demo.921.[0-2]
. By using changed
we get three series with mostly 0 but whenever one of the series changes its value we get a 1.
changed(demo.921.*)
This can be grouped with our original series demo.921.*
using the callback multiply
to get the original values for each time when one of our series changed.
groupByNode(group(changed(demo.921.*), demo.921.*), 2, 'multiply')
To get rid of all the zeros, we can modify our first query to keep only the ones when a value changed by applying removeBelowValue(1)
groupByNode(group(removeBelowValue(changed(demo.921.*), 1), demo.921.*), 2, 'multiply')
The last steps are to combine those 3 sparse series into one (I chose maxSeries
), closing the gaps by keepLastValue(9999)
and assigning a reasonable alias
.
alias(keepLastValue(maxSeries(groupByNode(group(removeBelowValue(changed(demo.921.*), 1), demo.921.*), 2, 'multiply')), 9999), 'result')
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello, I would like to ask question about multiple series: Let's assume that I have them three.
Those are metrics generated on different concurrently working servers, but they relate to same metric (which is count from external DB). What I would like to display on my Grafana panel is the only one series which contains values with greatest timestamp of this three (last that changed). I tried using groupByNode(7, 'last'), but it selects just one serie out of those three, but not with latest timestamp. Can you help/redirect me somehow?
To visualize better let's assume that I have this three series:
and what I would like to have is one instead which would look like (last that changed):