I have a set of data represented by the following Graphite query: *a*.Reads.*b*.Count
I’m trying to get a “sum” of the Count values, grouped by “b”, using this query: groupByNode(*a*.Reads.*b*.Count, 2, 'sum')
However, the issue I’m having is that there isn’t always data available, ‘a’ will always exist, but ‘b’ exists for some, but not for every ‘a’.
I’ve tried using a fallback series to replace the missing values but I can’t figure out how to create a series only populated with “0” to fall back to.
Is there a way to create a default “0” series or am I going in the wrong direction completely with this?
In Graphite, there isn’t a direct function to create a series filled only with zeros. However, you can handle missing data by combining your existing series with a zero series. Here’s how you can achieve this:
Use constantLine(0) to create a constant line with zero.
Combine this line with your existing series using the transformNull function.
Here’s an example of how you can implement this in your query:
This query will ensure that all missing values in the aggregated series are replaced with zero, providing you with a complete series even when some values are missing.
Thanks for the reply, I might need to explain it a bit better.
I have the following example series:
1.Reads.1.Count
1.Reads.2.Count
2.Reads.1.Count
2.Reads.3.Count
So the data isn’t missing as such, the series doesn’t exist.
What I’m finding is that when grouped, the sums for both *.Reads.2.Count and the *.Reads.3.Count series will be null.
If I use a fallBackSeries on another series before the groupByNode then the values are replaced as expected.
The issue I’m having is trying to create a series that can replace the values with 0 instead.
I tried it with constantLine(0), but this doesn’t seem to create the necessary time points.