michaeldmoore / michaeldmoore-multistat-panel

A smart table display panel with fixed, updating rows (or columns)
MIT License
57 stars 14 forks source link

Aggregate by sum #50

Closed rock420 closed 4 years ago

rock420 commented 4 years ago

Hi, thanks for this amazing plugin for grafana panel. I was wondering if there is an aggregate function to get the sum. I am using a table data(similar to the below one) from another panel and I want to get the total usage for each user. For this I have grouped by using user column. But after that I am not getting any aggregate function in the plugin to get the sum for each user. Is there any other way in the plugin to get the sum?

usage (in hours) user
21 A
19 B
25 A
12 C
10 B
michaeldmoore commented 4 years ago

Thanks for the suggestion. Adding a sum aggregation was trivial. While doing this though, I got a report that the newest version of Grafana - v7.1 broke Multistat altogether. I found and fixed the problem though - apparently, in the transition from Angular to React, Grafana 7.1 broke some backwards-compatibility features; in this case, the constructor-injected variableSvr parameter.

I released a fix in the form of Multistat 1.4.1 to address this, and add the 'sum' aggregation, as per your suggestion (and also fix the 'mean' aggregation that I hadn't noticed wasn't doing anything!!!).

It might take Grafana some days or even weeks before they process and approve this fixed version and add it to the official panel repository. You can download it here though, if you need it more quickly.

Regards Michael Moore