douqiao5543 2016-01-31 18:59
浏览 551
已采纳

如何在prometheus / client_golang中禁用go_collector指标

I am using a NewGaugeVec to report my metrics:

elapsed := prometheus.NewGaugeVec(prometheus.GaugeOpts{
    Name: "gogrinder_elapsed_ms",
    Help: "Current time elapsed of gogrinder teststep",
}, []string{"teststep", "user", "iteration", "timestamp"})
prometheus.MustRegister(elapsed)

All works fine but I noticed that my custom exporter contains all metrics from prometheus/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
...

I suspect that this is kind of a default behavior but I did not find anything in the documentation on how to disable that. Any ideas on how to configure my custom exporter so that these default metrics disappear?

  • 写回答

3条回答 默认 最新

  • douyihuaimao733955 2016-02-01 08:20
    关注

    This is not currently possible in the Go client, once https://github.com/prometheus/client_golang/issues/46 is complete you'll have a way to do this.

    In general you want your custom exporter to export these, the only ones I'm aware of where it doesn't currently make sense are the snmp and blackbox exporter.

    Incidentally timestamp seems odd as a label, if you want that you should likely be using logging rather than metrics. See https://blog.raintank.io/logs-and-metrics-and-graphs-oh-my/ The Prometheus way would be to have the timestamp as a value, not as a label.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题