Prometheus的Metrics名称不符合命名规则,无法读取错误
梗概
-
- PrometheusのMetrics名にはルールがある
- 守っていないとエラーで読み取ってくれない
经过
-
- 使用fluent-plugin-prometheus插件
-
- 将指标名称设为”2xx_count”
- 无法读取错误信息
我定義了下面的fluentd.config(摘錄)。
<filter status.*.*.*>↲
@type prometheus↲
<labels>↲
tag ${tag}↲
</labels>↲
<metric>↲
name 2xx_counter↲
desc 2xx counts↲
type counter↲
key 2xx_count↲
</metric>↲
</filter>
当运行Fluentd时,会出现以下错误,并且无法被读取。
第一行文本格式解析错误:注释中的度量名称无效。
因为这不符合Prometheus的指标命名规则。
将”name 2xx_counter” 更改为 “http_response_code_2xx_count” 后,它正常工作了。