Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: pull web.disable-exporter-metrics functionality into this package #119

Open
pdf opened this issue Jun 21, 2021 · 10 comments
Open

Comments

@pdf
Copy link

pdf commented Jun 21, 2021

The node_exporter implements a command-line flag web.disable-exporter-metrics that disables publishing the exporter's process stats. Pulling that functionality into this package with some sort of flag helper similar to promlog would allow all Go exporters to benefit from this behaviour without having to re-implement it.

@leahoswald
Copy link

leahoswald commented Jun 23, 2021

Great idea! I was just on my way to open a similar issue with a request to make it easy to disable the goCollector metrics as they seem only helpful during development but not in production for most exporters.

Currently I do this by adding this line to the code of some exporters right after the MustRegister call (not knowing if it is a bad idea): prometheus.Unregister(prometheus.NewGoCollector()

@justinbeal
Copy link

I have also done this by replacing the default registerer/gatherer in my codebases.
r := prometheus.NewRegistry()
prometheus.DefaultRegisterer = r
prometheus.DefaultGatherer = r

It'd be nice to not have to do this dance though, or filter out the go/process metrics in other ways.

@SuperQ
Copy link
Member

SuperQ commented Sep 21, 2021

I think it would be useful to have a configuration struct/method for the default Go/Process collector.

@beorn7
Copy link
Member

beorn7 commented Sep 21, 2021

The clearest way to not use the collectors already pre-registered with the default registry is indeed to create your own registry (which is anyway recommended for any non-trivial Go program to avoid global state).

The exporter metrics are somewhat different as they could be more than just those. Perhaps having that flag in https://github.com/prometheus/exporter-toolkit would make sense?

@stale
Copy link

stale bot commented Mar 25, 2022

Hello 👋 Looks like there was no activity on this issue for the last 3 months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next 4 weeks, this issue will be closed (we can always reopen an issue if we need!).

@pdf
Copy link
Author

pdf commented Mar 25, 2022

Still desirable for consistency.

@SuperQ
Copy link
Member

SuperQ commented Mar 25, 2022

I spun up a new exporter and noticed that the default registry now has 124 metrics. It would be nice to have a "light" mode that doesn't include a lot of the excessive details for simple exporters.

For example, I don't really need these two detailed histograms most of the time. But it would be nice to have a flag to enable them.

go_gc_heap_allocs_by_size_bytes_total_bucket{le="8.999999999999998"} 2.488515e+06
go_gc_heap_allocs_by_size_bytes_total_bucket{le="24.999999999999996"} 2.5126955e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="64.99999999999999"} 4.0245214e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="144.99999999999997"} 4.8441256e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="320.99999999999994"} 5.0162094e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="704.9999999999999"} 5.1115383e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="1536.9999999999998"} 5.1425539e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="3200.9999999999995"} 5.1477494e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="6528.999999999999"} 5.165292e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="13568.999999999998"} 5.1659736e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="27264.999999999996"} 5.1713698e+07
go_gc_heap_allocs_by_size_bytes_total_bucket{le="+Inf"} 5.1740452e+07
go_gc_heap_allocs_by_size_bytes_total_sum 1.0629995408e+10
go_gc_heap_allocs_by_size_bytes_total_count 5.1740452e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="8.999999999999998"} 2.484419e+06
go_gc_heap_frees_by_size_bytes_total_bucket{le="24.999999999999996"} 2.5115579e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="64.99999999999999"} 4.022865e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="144.99999999999997"} 4.8421552e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="320.99999999999994"} 5.0141065e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="704.9999999999999"} 5.1093727e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="1536.9999999999998"} 5.1403774e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="3200.9999999999995"} 5.1455678e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="6528.999999999999"} 5.163104e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="13568.999999999998"} 5.1637842e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="27264.999999999996"} 5.1691798e+07
go_gc_heap_frees_by_size_bytes_total_bucket{le="+Inf"} 5.1718539e+07
go_gc_heap_frees_by_size_bytes_total_sum 1.062535436e+10
go_gc_heap_frees_by_size_bytes_total_count 5.1718539e+07

@metonymic-smokey
Copy link

So, from what I understand, two new flags are needed:

  1. as @pdf suggests, one to disable all default metrics, for consistency with exporter-toolkit.
  2. as @SuperQ suggests, one to selectively turn on some metrics.

Please let me know if I missed something, trying to understand.
Thanks!

@stale
Copy link

stale bot commented Oct 30, 2022

Hello 👋 Looks like there was no activity on this issue for the last 3 months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next 4 weeks, this issue will be closed (we can always reopen an issue if we need!).

@SuperQ SuperQ transferred this issue from prometheus/client_golang Oct 30, 2022
@SuperQ
Copy link
Member

SuperQ commented Oct 30, 2022

I've moved this issue to the exporter-toolkit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants