6

我在普罗米修斯中有以下标签,如何在模板化“查询”之类的内容时创建通配符查询:“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
  },
4

2 回答 2

5

Prometheus 将指标名称视为带有特殊标签的标签值 - __name__。因此,以下查询应选择名称与正则表达式xyx匹配的指标的所有标签值:application_.*Count_total

label_values({__name__=~"application_.*Count_total"}, xyx)

于 2020-01-10T16:40:51.457 回答
2

@valyala,我得到了它的工作

"query": "metrics(application_get.*Count_total)",
"regex": "/application_get(.*)Count_total/",

于 2020-01-11T02:46:33.270 回答