Skip to content
BleemeoBleemeo

GitLab

Prometheus Metrics

GitLab is a comprehensive DevOps platform that exposes Prometheus metrics on dedicated ports for its various components.

In GitLab Omnibus installations, Prometheus monitoring is enabled by default. To allow Glouton to scrape metrics from localhost, edit /etc/gitlab/gitlab.rb and ensure the following settings are present:

# Allow local access to metrics
gitlab_rails['monitoring_whitelist'] = ['127.0.0.1']
# Ensure Prometheus metrics are enabled (default: true)
gitlab_rails['prometheus_monitoring_enabled'] = true

After editing, reconfigure GitLab:

Terminal window
sudo gitlab-ctl reconfigure

GitLab exposes metrics on several dedicated ports:

Component Endpoint Default Port
Puma (Rails) /-/metrics 9168
Gitaly /metrics 9236
GitLab Workhorse /metrics 9229
GitLab Exporter /metrics 9168

The example below targets the Puma/Rails endpoint and Gitaly. You can add more targets for other GitLab components (Workhorse, Sidekiq, etc.) following the same pattern with the appropriate port.

Terminal window
sudo tee /etc/glouton/conf.d/99-gitlab.conf > /dev/null << 'EOF'
metric:
prometheus:
targets:
- url: "http://localhost:9168/-/metrics"
name: "gitlab"
allow_metrics:
- "http_requests_total"
- "ruby_process_resident_memory_bytes"
- "gitlab_transaction_duration_seconds*"
- "gitlab_sql_duration_seconds*"
- url: "http://localhost:9236/metrics"
name: "gitaly"
allow_metrics:
- "gitaly_connections_total"
- "gitaly_*"
EOF
MetricDescription
http_requests_totalTotal number of HTTP requests handled
ruby_process_resident_memory_bytesResident memory size of the Ruby process
gitlab_transaction_duration_secondsDuration of Rails controller transactions
gitlab_sql_duration_secondsTime spent on SQL queries
gitaly_connections_totalTotal number of Gitaly connections