从GaugeVec中删除Gauge的golang prometheus客户端。

huangapple go评论88阅读模式
英文:

client_golang prometheus remove gauge from gaugevec

问题

从gaugevec中删除一个仪表时,该仪表的值仍然以其最后设置的值显示在图表上。它似乎在5分钟后过期。有没有一种方法在删除后立即停止仪表数据?将值设置为0会保留过时的仪表,随着时间的推移会积累起来,而没有TTL。

示例:
gaugeVec.Delete(labels) // 不会立即删除仪表。

英文:

When deleting a gauge from a gaugevec, the gauge value is still presented on the graph as the value it was last set to. It seems to expire after 5 minutes. Is there a way to immediately discontinue the gauge data upon deletion? Setting the value to 0 retains the stale gauges, which accumulate over time, without a TTL.

Example:
gaugeVec.Delete(labels) // does not remove the gauge immediately.

答案1

得分: 1

正如你提到的,服务器每5分钟拉取一次数据,这也是Prometheus服务器反映数据所需的时间。删除或注销指标不会将数据推送到Prometheus服务器,这将在下一次抓取时被获取。

根据你有多迫切需要这样做,有几种方法可以将指标推送到Prometheus。你可以参考这里了解更多信息。

英文:

As you mentioned, the server pulls data every 5 minutes and this is the time it will take for prometheous server to reflect. Deleting or unregistering a metric will not push data to prometheus server, this will have to be picked up on next scrape.

There are ways to push metrics to promeheus, depending how badly you need this to happen.

huangapple
  • 本文由 发表于 2022年10月27日 08:51:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/74215628.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定