akumuli / akumuli-datasource

Datasource plugin for grafana
Apache License 2.0
23 stars 4 forks source link

Support for timeshift per metric #18

Closed Tezar closed 4 years ago

Tezar commented 4 years ago

Would it be possible to add options to set timeshift per query/series? It would be nice to be able to compare current trend with day before in one graph.

Lazin commented 4 years ago

Yes, it is possible. But it'll get some time because changes will have to be made in the grafana plugin and in the database.

Lazin commented 4 years ago

Why built-in Grafana time-shift function doesn't work for you?

Tezar commented 4 years ago

Timeshift works on whole graph. So I can make two separate graphs, but you cant get good comparsion from that (since axis are usually both set on auto). Ability to set shift per metric is already supported by some datasources because of this.

Lazin commented 4 years ago

I implemented this feature but because of Grafana limitation I had to match timestamps with current time-range. So if you'll hover your cursor over the panel the timestamp will be the same for both normal and shifted series. It's not very intuitive. Can be solved by setting proper alias for shifted metrics.

Lazin commented 4 years ago

If you want to test this feature, you can check out time-shift-parameter branch. There is a time-shift field in the query editor which can be used to shift series back. You can specify only simple intervals now using format, for instance 1y (year), 1h (hour) or 1m (minute) or 1M (month).

Tezar commented 4 years ago

Great, works for some quick test I tried, thanks. Tiny difference in handling time shift value: grafana doesn't allow negative values. Getting data from yesterday is "24h" in grafana, but "-24h" in your plugin. While I would argue, that negative timeshift makes more sense, grafana uses it inversely and that may spark some misunderstandings. Maybe info in the tooltip would be enough.

Tezar commented 4 years ago

Couldn't find any link to beer fund :beer: ?
:smiley:

Lazin commented 4 years ago

I'm going to change the shift value direction to match grafana behaviour and reorganize UI a bit since it's getting a bit clunky.

No beer fund unfortunately. But you can help the project by doing what you're already do. Use the database and give feedback and share the results.

Lazin commented 4 years ago

The plugin is already published and available here (way faster than I anticipated).