monitoring: allow disabling specific features on start
Currently, monitoring.Start
does the following actions:
- Setup continuous profiling (bypassed internally if the
GITLAB_CONTINUOUS_PROFILING
environment variable is not set); - Setup Prometheus metrics handler
- Setup Go pprof handlers
There is no option to disable metrics and pprof handlers, neither an explicit option to disable the continuous profiler. We can't set up them individually either, as Start
is the only exposed API.
We're currently working on integrating the monitoring package in the GitLab Container Registry, where we already expose metrics and a pprof server, which can be toggled individually based on existing configuration settings. To avoid breaking changes we need to continue to support this.
This MR proposes the addition of three new monitoring.Option
s:
-
monitoring.WithoutContinuousProfiling()
: Bypass continuous profiler setup. -
monitoring.WithoutMetrics()
: Bypass metrics handler setup. -
monitoring.WithoutPprof()
: Bypass pprof handlers setup.