Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Aggregate/Sum across metric with wild-card like sum(cpu.*.system)? #20

Closed
vguhesan opened this issue Jul 5, 2016 · 3 comments
Closed

Comments

@vguhesan
Copy link

vguhesan commented Jul 5, 2016

Is there a way to aggregate across metrics/metric-names? For example, on a four core system, you have the following metric-names:

cpu.0.system
cpu.1.system
cpu.2.system
cpu.3.system

I would like to SUM(cpu.*.system) to get the aggregated cpu.system.total.

Is there a way to accomplish this with the current Grafana-KairosDB query-editor?

Please advise.

@vguhesan vguhesan changed the title Aggregate/Sum across metric with wild-card? Aggregate/Sum across metric with wild-card like SUM(cpu.*.system)? Jul 5, 2016
@vguhesan vguhesan changed the title Aggregate/Sum across metric with wild-card like SUM(cpu.*.system)? Aggregate/Sum across metric with wild-card like sum(cpu.*.system)? Jul 5, 2016
@BrandonArp
Copy link
Contributor

This is also something I'm looking into. The problem is that Kairos doesn't store the metrics in a hierarchical way like Graphite does. There are a couple of ways to approach this problem:

1 - Query the metrics index (for all of the metrics from Kairos) and create the query with the matching metrics. This would allow us to handle the case completely in Grafana.
2 - Extend Kairos to support wildcards in the metrics query language. Kairos would still need to do the lookup for matching metrics, but it would probably be faster since it can cache metric names (or at least be closer to the data).

I would like to work on this feature, but don't have a lot of dev time for it at the moment.

@vguhesan
Copy link
Author

vguhesan commented Jul 11, 2016

Hi @BrandonArp, personally I prefer option 2 (from your recommendation) since that seems to be inline with the way OpenTSDB-Grafana UI is offering. In OpenTSDB UI is an "Aggregate" option at the Metric-name level. See screenshots included below.
The option that Kairosdb offers is to aggregate the "downsamples" similar to the second highlighted dropdown in OpenTSDB.

If Kairosdb were to offer the same, it will need to implement a way to query a comma-separated list of metrics in the "name" field. And then choose the scheme to apply on the resulting array(s) of data such as aggregate/avg/mean/median/etc. But this will keep both OpenTSDB and Kairosdb in sync with features.

grafana-opentsdb-ui

grafana-kairosdb-ui

Folks - can I get some up votes on this feature?

@jifwin
Copy link
Contributor

jifwin commented Dec 19, 2016

I'll just share my thoughts on that. In my opinion cross-metrics calculations should be done on server side. I am also looking for that feature and possibly contribute to KairosDB in the near future. Alternatively we could have general operations on data series, but I think it should be independent of the plugin and implemented in the Grafana itself. I guess this PR can be closed.

@jifwin jifwin closed this as completed Dec 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants