简体   繁体   English

有没有办法在普罗米修斯中为从 pushgateway 抓取的类似指标增加计数器

[英]Is there a way to increment counter in prometheus for similar metrics scraped from pushgateway

I have a running instance of pushgateway and prometheus.我有一个正在运行的 pushgateway 和 prometheus 实例。 And prometheus is configured to scrape from pushgateway.并且 prometheus 被配置为从 pushgateway 中抓取。 I am able to push metrics from my .NET applications to pushgateway which are successfully scraped by my prometheus.我能够将指标从我的 .NET 应用程序推送到我的 prometheus 成功抓取的 pushgateway。 But when a two similar metrics are pushed to pushgateway, they are considered as one by the prometheus and the count is always displayed as one.但是当两个相似的指标被推送到 pushgateway 时,它们被 prometheus 视为一个,并且计数始终显示为一个。 Is there a way to increment the prometheus count value when similar metrics are present in the pushgateway.当推送网关中存在类似指标时,是否有办法增加普罗米修斯计数值。

The metrics from the two apps should be separated by adding a label that will distinguish between them.应该通过添加 label 来区分这两个应用程序的指标,以区分它们。 This should solve your issue.这应该可以解决您的问题。 Note that the pushgateway docs explicitly state that there should be no duplicate metrics.请注意,pushgateway 文档明确指出 state 不应该有重复的指标。

Pushgateway is not designed to handle this situation. Pushgateway 不是为处理这种情况而设计的。 As the official doc said, Usually, the only valid use case for the Pushgateway is for capturing the outcome of a service-level batch job.正如官方文档所说, Usually, the only valid use case for the Pushgateway is for capturing the outcome of a service-level batch job.

https://prometheus.io/docs/practices/pushing/#should-i-be-using-the-pushgateway https://prometheus.io/docs/practices/pushing/#should-i-be-using-the-pushgateway

Or you can use this instead, which is a aggregating push gateway for Prometheus: https://github.com/weaveworks/prom-aggregation-gateway或者您可以使用它,它是 Prometheus 的聚合推送网关: https://github.com/weaveworks/prom-aggregation-gateway

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM