gitlab-org/gitlab
Metrics server
A small companion process that exposes Puma and Sidekiq Prometheus metrics from a separate port to avoid blocking app workers.
Purpose
Prometheus scrapes need to hit /metrics. If they hit the main Puma port, scrapes contend with real traffic. The metrics server runs on its own port and reads aggregate metrics from a shared memory file or the prometheus-client-mmap directory.
Source layout
metrics_server/
├── metrics_server.rb # Server entrypoint
└── ...How it integrates
lib/gitlab/metrics/exporter/provides the base exporter classes.Gitlab::Metrics::Exporter::SidekiqExporterexports Sidekiq metrics.Gitlab::Metrics::Exporter::WebExporterexports Puma metrics.- The server is launched by
bin/metrics-server(via Omnibus or systemd) and reads the sameprometheus_multiproc_dirthat Puma writes to.
Config
Metrics server configuration lives in config/initializers/0_metrics.rb and lib/gitlab/metrics/exporter/. Environment variables:
prometheus_multiproc_dir— shared mmap directory.- Listen port — usually 8083 (Puma) / 8082 (Sidekiq).
Related
- Metrics — what's exposed and how it's consumed.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.