我在prometheus中有以下标签,如何在模板化时创建通配符查询 类似于“查询”:“ label_values(application_ * Count_Total,xyx)”。这些值是从Eclipse Microprofile REST-API生成的
application_getEnvVariablesCount_total
application_getFEPmemberCount_total
application_getLOBDetailsCount_total
application_getPropertiesCount_total
{
"allValue": null,
"current": {
"isNone": true,
"selected": false,
"text": "None",
"value": ""
},
"datasource": "bcnc-prometheus",
"definition": "microprofile1",
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "newtest",
"options": [
{
"isNone": true,
"selected": true,
"text": "None",
"value": ""
}
],
"query": "microprofile1",
"refresh": 0,
"regex": "{__name__=~\"application_.*Count_total\"}",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
答案 0 :(得分:3)
Prometheus将度量标准名称与带有特殊标签-__name__
的标签值的处理方式相同。因此,以下查询应在名称与xyx
regexp匹配的度量中选择标签application_.*Count_total
的所有值:
label_values({__name__=~"application_.*Count_total"}, xyx)
答案 1 :(得分:0)
@valyala,我可以使用它
"query": "metrics(application_get.*Count_total)",
"regex": "/application_get(.*)Count_total/",