GitLab Maintenance Mode should be exported via a Prometheus Metric

What does this MR do and why?

Adds a new worker and service class to update instance wide metrics that are not specific to any specific context (user/project/shard/vm/process)

Adds maintenance_mode state to the global metrics

How to set up and validate locally

  1. Enable Sidekiq exporter (via gitlab.yml):
     sidekiq_exporter:
       enabled: true
       address: localhost
       port: 3807
  2. Enable or disable maintenance mode in application settings
  3. Wait for the cronjob to run (every minute)
  4. Check whether gitlab_maintenance_mode metric is being exported (access http://localhost:3807/metrics):
    # HELP gitlab_maintenance_mode Multiprocess metric
    # TYPE gitlab_maintenance_mode gauge
    gitlab_maintenance_mode{pid="sidekiq_0"} 0

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #387627 (closed)

Edited by Gabriel Mazetto

Merge request reports

Loading