Open-Source Wikis

/

GitLab

/

Apps

/

Metrics server

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::SidekiqExporter exports Sidekiq metrics.
  • Gitlab::Metrics::Exporter::WebExporter exports Puma metrics.
  • The server is launched by bin/metrics-server (via Omnibus or systemd) and reads the same prometheus_multiproc_dir that 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).
  • 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.

Metrics server – GitLab wiki | Factory