【发布时间】:2018-01-11 13:04:35
【问题描述】:
对于已停用(例如,实例在异常情况下关闭)且不使用人工干预的应用,清除 PushGateway 中的陈旧数据的可靠方法是什么?
【问题讨论】:
标签: prometheus prometheus-pushgateway
对于已停用(例如,实例在异常情况下关闭)且不使用人工干预的应用,清除 PushGateway 中的陈旧数据的可靠方法是什么?
【问题讨论】:
标签: prometheus prometheus-pushgateway
您可以使用以下网址清除/删除应用的指标数据/作业
工作名称:sample_job
curl --location --request DELETE 'http://localhost:9091/metrics/job/sample_job'
如果您正在运行同一应用的多个实例,您也可以删除单个实例的指标,
工作名称:sample_job
和
InstnaceId = 20148
curl --location --request DELETE 'http://localhost:9091/metrics/job/sample_job/instance/20148'
成功码 - 202
但唯一的问题可能是, 如果应用程序在退出时从 pushGateway 中删除自己的指标,prometheus 可能会丢失它。是的,如果应用在 prometheus 抓取 pushgateway 之间退出。
【讨论】:
Pushgateway 用于服务级别的批处理作业,这些作业是独立的,是可以关闭的单个服务实例。您可能想要做的是直接使用 Prometheus 抓取此实例,而不是尝试将 Prometheus 转换为 push。
【讨论】: