首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring PushGateway推送没有实例标记的度量。

Spring PushGateway推送没有实例标记的度量。
EN

Stack Overflow用户
提问于 2019-09-16 13:23:46
回答 1查看 1.5K关注 0票数 2

这是我的配置:

代码语言:javascript
复制
management.metrics.export.prometheus=true
management.metrics.export.prometheus.pushgateway.enabled=true
management.metrics.export.prometheus.pushgateway.push-rate=1m
management.metrics.export.prometheus.pushgateway.base-url=<IP>:9091
management.metrics.export.prometheus.pushgateway.job=myjob

查看<IP>:9091/metrics的PushGateway端点,我看到以下标记:

代码语言:javascript
复制
{instance="",job="myjob"}

理想情况下,我希望“实例”是正在运行的服务的ip地址和端口。

值得一提的是,我在Promethoues中使用了honor_labels: true

如何设置实例标记(如果可能的话自动设置)?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-17 19:01:41

以下内容--将其设置为分组中的键值--键映射--应该可以做到这一点:

代码语言:javascript
复制
management.metrics.export.prometheus.pushgateway.grouping-key.instance=${hostname:localhost}:${server.port}

您不一定需要设置“作业”属性,因为它是从spring.application.name派生的,然后是回退。见这里

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57957839

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档