Skip to content

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:

ComponentEndpointDefault Port
Puma (Rails)/-/metrics9168
Gitaly/metrics9236
GitLab Workhorse/metrics9229
GitLab Exporter/metrics9168

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
Metric Description
http_requests_total Total number of HTTP requests handled
ruby_process_resident_memory_bytes Resident memory size of the Ruby process
gitlab_transaction_duration_seconds Duration of Rails controller transactions
gitlab_sql_duration_seconds Time spent on SQL queries
gitaly_connections_total Total number of Gitaly connections