How to create a cumulative histogram from 1 measurement field with a limited list of values

Hello, I’m taking some time during the quarantine to learn Grafana :slight_smile:
I have been recording data in InfluxDB for a while and I’m trying to display it.

I have a measurement series where a measurement is taken multiple times per day and the outcome is one of a short list of status (let’s say A, B, C or D). Is this called a wildcard series?

I would like to plot these measurements in a cumulative histogram, where the frequencies all stack on top of each other.

I think it’s more or less what is discussed here https://stackoverflow.com/questions/42655742/how-to-plot-percentage-on-grafana, but the solution is for Graphite, which does not apply to my case because I’m using InfluxDB? This part is a bit confusing.

I also found this example https://play.grafana.org/d/000000012/grafana-play-home?orgId=1&from=1587337281236&to=1587344481236&panelId=5&fullscreen, only that in my case I’d like the top to always be 100%. The problem here is that the data source is again Graphite and the query is not written in SQL and I don’t know how to do the same in SQL.

I can get a time series for just one of the options with
SELECT count("status") FROM "server_status" WHERE ("server" = 'myserver' AND "status" = 'A') AND $timeFilter GROUP BY time(1d) fill(null)

InfluxDB doesn’t allow mixing aggregate and non-aggregate functions, so I don’t think there is a way to SELECT a single data series with counts by day and status. As a new user I can post max 2 links, so for reference, search for ‘influxdata error-parsing-query-mixing-aggregate-and-non-aggregate-queries-is-not-supported’

I could repeat the SQL statement above and create one query for each A, B, C and D, but that seems like a clunky way to do it. Is there an automatic way to fetch daily counts of all the status? This way if the status list changes in the future, they will still be displayed correctly / automatically, without any modifications to the panel.

2 Likes