Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Prometheus 如何获取grafana查询的实例总数_Prometheus_Grafana - Fatal编程技术网

Prometheus 如何获取grafana查询的实例总数

Prometheus 如何获取grafana查询的实例总数,prometheus,grafana,Prometheus,Grafana,在我的grafana中,我跟踪节点导出器和进程导出器的运行实例。在这方面,我使用了查询 namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary"} 对于这个查询,我得到了节点导出器和进程导出器的多个进程运行实例。例如,对于上面的查询,我得到的结果如下: namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary",groupna

在我的grafana中,我跟踪节点导出器和进程导出器的运行实例。在这方面,我使用了查询

namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary"}
对于这个查询,我得到了节点导出器和进程导出器的多个进程运行实例。例如,对于上面的查询,我得到的结果如下:

namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary",groupname="processexporter",job="processexporter"} 45678
namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary",groupname="processexporter",job="processexporter"} 98767
namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary",groupname="nodeexporter",job="nodeexporter"} 64835
namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary",groupname="nodeexporter",job="nodeexporter"} 36217
我想更改查询以显示运行中Instance的总数,如

namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary",groupname="processexporter",job="processexporter"} 144445
namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary",groupname="nodeexporter",job="nodeexporter"} 101052 

请帮助我如何获得运行实例的总和值

我通过运行查询获得的值

sum by (groupname) (namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary"})

我们可以使用sum by(使用任何标记)中的任何标记,例如job、groupname、ctxswitchtype来过滤通过运行查询实现的

sum by (groupname) (namedprocess_namegroup_context_switches_total{ctxswitchtype="voluntary"})
我们可以使用sum by(使用任意标记)中的任意标记(如job、groupname、ctxswitchtype)进行筛选