Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.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
Regex 在prometheus递增查询中使用正则表达式_Regex_Prometheus_Promql - Fatal编程技术网

Regex 在prometheus递增查询中使用正则表达式

Regex 在prometheus递增查询中使用正则表达式,regex,prometheus,promql,Regex,Prometheus,Promql,我正在使用grafana和prometheus查询来自不同环境和实例/集群的几个指标。Regex帮助我减少grafana仪表板中的查询数量 例如,我没有为每个实例创建查询(有时我不知道实例名称或数量),而是使用以下方法: {__name__=~"ReadUser:.*",account="dev",Function="Max"} 通过这种方式,我从几个不同的动态创建的实例中获取有关读取用户操作的度量 当然,我不能在这样的查询中使用它:

我正在使用grafana和prometheus查询来自不同环境和实例/集群的几个指标。Regex帮助我减少grafana仪表板中的查询数量

例如,我没有为每个实例创建查询(有时我不知道实例名称或数量),而是使用以下方法:

{__name__=~"ReadUser:.*",account="dev",Function="Max"}
通过这种方式,我从几个不同的动态创建的实例中获取有关读取用户操作的度量

当然,我不能在这样的查询中使用它:

increase(ReadUser:<instance-name>{account="dev",Function="TotalDuration"}[30s]) / ignoring(Function) increase(ReadUser:<instance-name>{account="dev",Function="Counter"}[30s])
增加(ReadUser:{account=“dev”,Function=“TotalDuration”}[30s])/忽略(函数)增加(ReadUser:{account=“dev”,Function=“Counter”}[30s])

我的问题是如何使用regex,以便只使用一个promql查询来显示所有可用实例的查询结果(请记住,它们是动态创建的,可能会达到相当大的数量)

简单明了:不要将实例名称之类的内容放入度量名称中。如果无法在源代码中更改,请使用metric relabel config重写标签。

这不是很有帮助,但谢谢。度量名称在不久的将来不会更改。那么,您是否有权访问
prometheus.yml
?你能给它加点东西吗?