简体   繁体   English

如何计算grafana数据源弹性中的百分比

[英]How to calculate percentage in grafana datasource elastic

Need your help,需要你的帮助,

currently I have value elastic data sample like below :目前我有如下价值弹性数据样本:

Completed : 100
Declined : 20
Canceled : 5

How to create percentage success rate result with above condition in grafana with formula :如何使用公式在grafana 中创建具有上述条件的百分比成功率结果:

Completed / ( Completed + Declined + Canceled )已完成 /(已完成 + 已拒绝 + 已取消)

expected result :

success rate : 99,13 %

Need your feedback please, thanks.需要您的反馈,谢谢。

A solution could be done by the plugin grafana-meta-queries which provided a way to made arithmetic operations with a mix of result of request made in grafana.一个解决方案可以通过插件grafana-meta-queries来完成,它提供了一种方法来进行算术运算,并混合在 grafana 中提出的请求结果。

  1. Install the plugin (you need to made a git clone in grafana/plugin directory and restart your server)安装插件(你需要在 grafana/plugin 目录下创建一个 git clone 并重启你的服务器)
  2. Create a panel and put it in the 3 query that provided your Completed/Declined/Canceled result创建一个面板并将其放入提供已完成/拒绝/取消结果的 3 个查询中
  3. Put in this same panel another query with MetaQueries for datasource and into this query made an arithmetic type of query where you put the operation with the result of the other query wihch looks like this在同一个面板中,使用 MetaQueries 为数据源放置另一个查询,并在此查询中创建一个算术类型的查询,您将操作与另一个查询的结果放在一起,如下所示

B['Completed'] / (C['Declined']+B['Completed'] +D['Canceled']) B['已完成'] / (C['拒绝']+B['已完成'] +D['已取消'])

I've tried the solution with grafana 7.3.4 and elastic-oss 7.9.1 and the latest version of plugin and this works.我已经尝试过使用 grafana 7.3.4 和 elastic-oss 7.9.1 以及最新版本的插件的解决方案,并且有效。

Here a screen shot of a the panel set :这是面板集的屏幕截图:

在此处输入图片说明

The alert engine publishes some internal metrics about itself.警报引擎会发布一些关于自身的内部指标。 You can read more about how Grafana publishes internal metrics.您可以阅读有关 Grafana 如何发布内部指标的更多信息。

Total number of alerts  counter alerting.active_alerts
Alert execution result  counter alerting.result
Notifications sent counter  counter alerting.notifications_sent
Alert execution timer   timer   alerting.execution_time

also find info at https://grafana.com/docs/grafana/latest/alerting/还可以在https://grafana.com/docs/grafana/latest/alerting/找到信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM