我使用的是NewGaugeVec汇报我的指标:如何禁用普罗米修斯/ client_golang go_collector指标
elapsed := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "gogrinder_elapsed_ms",
Help: "Current time elapsed of gogrinder teststep",
}, []string{"teststep", "user", "iteration", "timestamp"})
prometheus.MustRegister(elapsed)
所有工作正常,但我注意到,我的自定义导出包含普罗米修斯/ go_collector.go所有指标:
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0.00041795300000000004
go_gc_duration_seconds{quantile="0.25"} 0.00041795300000000004
go_gc_duration_seconds{quantile="0.5"} 0.00041795300000000004
...
我怀疑这是一种默认行为,但在文档中找不到关于如何禁用该行为的任何内容。有关如何配置我的自定义导出器以使这些默认指标消失的任何想法?
嗯,如果我没有记错的话prometheus声称不要自以为是......如果说我为我的盆栽植物保持一个湿度传感器网络。如果一家工厂报告其goroutines,gc统计等数量,我觉得很奇怪。很高兴知道这已经在进行中。感谢指标文章! – mark
普罗米修斯颇有见地,因为很多乍一看似乎是个好主意的东西其实都是反模式。拥有所有关键系统指标非常重要,包括出口商本身的表现。通过刮擦自动获得它几乎总是正确的做法。某些盆栽植物可能属于无意义的类别,您应根据具体结构分别监控出口商。 –
看起来这个问题已经完成,但仍然无法禁用此功能。有'init()'(Golang称之为),它会无意识地启动Go运行时和进程收集器:https://github.com/prometheus/client_golang/blob/69bb3870645f63c67a8dc9c9ef94585fd0d98c80/prometheus/registry.go#L51 –