Add gitlab-metrics-exporter component
What does this Merge Request do and why?
We are replacing our Ruby application metrics exporter(s) with a new Golang server as part of &7396 (closed).
These changes make sure the GDK sets up this system for developers. It is not EE-only so should always be available.
We pretty much based this on the approach gitlab-elasticsearch-indexer
was taking, since these two systems share a lot of similarities.
Notes:
- The dedicated metrics exporter will run whenever it is enabled in
gitlab.yml
in themonitoring
section:-
web_exporter
for Puma -
sidekiq_exporter
for Sidekiq
-
- This is not a runit managed service, because it is not considered standalone when running alongside Rails or Sidekiq. Instead, the Rails app itself manages its life-cycle. These two systems are intimately coupled because the exporter requires filesystem access to application metrics. Plus, we do not want the exporter to be up when Rails is down (and vice versa), since that might confuse Prometheus into thinking that Rails is
up
just because the exporter is. - Since Rails manages its life-cycle, it must be able to shell out to it. This is why I added the bin folder to
PATH
forrails-background-jobs
andrails-web
. - Since the new server is built as a drop-in replacement for the existing Ruby metrics servers, no new settings are required.
- In order to test this, one must set
GITLAB_GOLANG_METRICS_SERVER=1
, which acts as a feature toggle, to actually run this server instead of the Ruby ones.
Merge Request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise Issue to follow-up. -
Documentation added/updated, if needed. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.
Closes #1465 (closed)
Edited by Ash McKenzie