具有不同帮助文本的普罗米修斯指标的含义?
Implications of a Prometheus metric with different help texts?
如果指标的帮助文本发生变化(即在部署之间),会发生什么情况?
这是我从 /api/v1/targets/metadata
获得的一些示例输出。它显示了两个具有相同指标名称 my-counter
但不同帮助文本的实例。
一审:
"target": {
"instance": "instance-1:6000",
"job": "app"
},
"metric": "my-counter",
"type": "counter",
"help": "This counts something"
第二个实例:
"target": {
"instance": "instance-2:6000",
"job": "app"
},
"metric": "my-counter",
"type": "counter",
"help": "This counts the same thing, just different help text"
普罗米修斯 dashboard/charts 似乎并不关心。还有其他影响吗?
我问是因为在 prometheus/client_golang 的 Go 文档中说:
Descriptors registered with the same registry have to fulfill certain consistency and uniqueness criteria if they share the same fully-qualified name: They must have the same help string and the same label names [...].
据我所知,唯一性约束仅适用于客户端。 IE。如果你声明两个同名的指标,它们应该有相同的标签和帮助文本,否则客户端会崩溃(因为它必须在同一个 /metrics
页面上公开这两个指标的时间序列,一个帮助字符串)。
Prometheus 服务器不关心解析阶段之外的帮助字符串(甚至计数器与仪表,就此而言)。所以它永远不会知道同一个指标在不同的目标上有不同的帮助字符串。
我也很确定(尽管在这方面不要引用我的话)普罗米修斯服务器不关心同一指标的标签在多个实例中是否相同。否则,您将无法向现有指标添加标签并在不丢失数据的情况下滚动升级您的服务。
换句话说,客户端试图非常严格地接受应用程序的内容;但是服务器需要非常宽松地接受来自目标的内容。对于初学者来说,这些目标甚至可能不使用其中一个客户端库(无论如何它们之间存在差异),而是从头开始滚动自己的 /metrics
页面。 (尽管 Prometheus 可能仍然不喜欢同一 /metrics
页面上具有不同标签集的两个指标。
如果指标的帮助文本发生变化(即在部署之间),会发生什么情况?
这是我从 /api/v1/targets/metadata
获得的一些示例输出。它显示了两个具有相同指标名称 my-counter
但不同帮助文本的实例。
一审:
"target": {
"instance": "instance-1:6000",
"job": "app"
},
"metric": "my-counter",
"type": "counter",
"help": "This counts something"
第二个实例:
"target": {
"instance": "instance-2:6000",
"job": "app"
},
"metric": "my-counter",
"type": "counter",
"help": "This counts the same thing, just different help text"
普罗米修斯 dashboard/charts 似乎并不关心。还有其他影响吗?
我问是因为在 prometheus/client_golang 的 Go 文档中说:
Descriptors registered with the same registry have to fulfill certain consistency and uniqueness criteria if they share the same fully-qualified name: They must have the same help string and the same label names [...].
据我所知,唯一性约束仅适用于客户端。 IE。如果你声明两个同名的指标,它们应该有相同的标签和帮助文本,否则客户端会崩溃(因为它必须在同一个 /metrics
页面上公开这两个指标的时间序列,一个帮助字符串)。
Prometheus 服务器不关心解析阶段之外的帮助字符串(甚至计数器与仪表,就此而言)。所以它永远不会知道同一个指标在不同的目标上有不同的帮助字符串。
我也很确定(尽管在这方面不要引用我的话)普罗米修斯服务器不关心同一指标的标签在多个实例中是否相同。否则,您将无法向现有指标添加标签并在不丢失数据的情况下滚动升级您的服务。
换句话说,客户端试图非常严格地接受应用程序的内容;但是服务器需要非常宽松地接受来自目标的内容。对于初学者来说,这些目标甚至可能不使用其中一个客户端库(无论如何它们之间存在差异),而是从头开始滚动自己的 /metrics
页面。 (尽管 Prometheus 可能仍然不喜欢同一 /metrics
页面上具有不同标签集的两个指标。