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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵