在 Grafana 中计算加权平均值

问题描述

我有以下格式的 Elasticsearch 数据源

[
    {
        count: 22,avg: 36
    },{
        count: 4,avg: 9
    },{
        count: 17,avg: 5
    },{
        count: 47,avg: 56
    },.
    .
    .
]

在 Grafana 中,我试图绘制加权平均值,但我所能做的就是

(36+9+5+56)/(22+4+17+47) = 1.17

enter image description here

我真正想要的是

[(22*36)+(4*9)+(17*5)+(47*56)]/(22+4+17+47)=39.39

这可以在 Grafana 中实现还是我应该将数据源更改为

[
    {
        count: 22,avg: 36,total: 792
    },avg: 9,total: 36
    },avg: 5,total: 85
    },avg: 56,total: 2632
    },.
    .
    .
]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)