Skip to content

Start a separate metrics server that can serve Sidekiq metrics

Roy Zwambag requested to merge 346256-run-separate-metrics-server into master

What does this MR do and why?

This MR will spin up a separate metrics server that serves Sidekiq metrics. For backwards compatibility, we default the Sidekiq health checks to the same settings as this new sidekiq metrics server, context: !74875 (merged).

Since we can not run two processes on the same port, the metrics server will only spin up if a different port has been set for the health check server (instead of defaulting to the sidekiq_exporter settings). This allows us to slowly migrate to different servers for Sidekiq metrics serving and Sidekiq health checks.

How to set up and validate locally

  1. We will have to overwrite the default settings for Settings.monitoring.sidekiq_health_checks.port, since they default to Settings.monitoring.sidekiq_exporter.port. With gdk you can change the gitlab.yml and set Settings.monitoring.sidekiq_health_checks.port to any other number. e.g.
    sidekiq_exporter:
      enabled: true
      address: 127.0.0.1
      port: 3807
    sidekiq_health_checks:
      port: 3907
  1. Open rails console
  2. Start the metrics server:
require_relative 'metrics_server/metrics_server'
MetricsServer.spawn('sidekiq')
  1. See if the sidekiq workers are healthy curl localhost:3907/liveness
  2. See if the metrics server is serving metrics curl localhost:3807/metrics

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 #346256 (closed)

Edited by Roy Zwambag

Merge request reports