Ageing chart - how to create variable series?

Afternoon all - I am wanting to show an “ageing” chart on the dashboard . It’s basically trying to show how long an issue was open since it was created. So, for all issues created within the time range, sort them into series of “length open”.

An additional kicker is that obviously an issue could be open from 1 day to 10000 days - so I wouldn’t want 10000 series, so I would want 1d, 2d, 1w, 2w, 3w, 4w, 1m 2m, 3m … 1yr+ etc

Is this possible ? The datasource is influxdb

Don’t think InfluxDB supports this type of query

urgh. Do you know a time-series database that does ? I’m open to move to another system

No, this type of query is actually not something I know any tsdb support, it i understand you correctly you want to show how long a metric has had a value?

Never thought about it that way, but yes, I think I do :wink:

You can do this with graphite and its functions. If you write the timestamp of the issue creation to a metric then you can subtract it from the current time to get the age. For example you might write a metric for issue 473:

issues.473.create_timestamp = 1501477200

In grafana you can then make a graphite query that is


This will give you a graph of the number of seconds since the create timestamp. The down side is you need to regularly update a metric with a constant value at sufficient time resolution for your needs. If you’re measuring many other aspects of issues maybe this isn’t an overhead, and you could use statsd gauges to accomplish this - just write a new gauge whenever an issue is created.

Another option with graphite wouldn’t involve having to write any actual metrics at all - you can use the offset() function:


But you’d need some way of populating the offset value - maybe write the dashboard programatically via Grafana API, or use templating somehow.
Either way once you have a panel in Grafana you can set the unit to time > seconds and get a readable days / weeks label.