【问题标题】:Adding labels in prometheus_pushgateway在 prometheus_pushgateway 中添加标签
【发布时间】:2017-08-02 07:34:31
【问题描述】:
    registry = CollectorRegistry()
    g = Gauge('some_metrices', 'metrics', "[node]",registry=registry)
    g.lables("worker").set(101)
    push_to_gateway('localhost:9091', job='batchA', registry=registry)

//如果我尝试在没有标签 [node] 的情况下使用,那么我可以在我的 prometheus 中创建一个度量,但是如果我使用标签,我会收到错误。请告诉我哪里出错了

raise ValueError('Invalid label metric name: ' + l)
ValueError: Invalid label metric name: [

【问题讨论】:

  • 你能找出正确的语法吗?我开始时和你很像,但我的语法不正确。

标签: prometheus


【解决方案1】:

[node] 不是有效的标签名称,度量名称中不能有方括号。 node 会起作用。

我还建议阅读https://prometheus.io/docs/practices/pushing/

【讨论】:

  • 是的,我现在可以添加我犯了一些错误。谢谢@brian
猜你喜欢
  • 2015-09-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-06
  • 1970-01-01
  • 1970-01-01
  • 2019-07-13
  • 2018-05-01
相关资源
最近更新 更多