Skip to content

Replace metrics FF with environment variable

Will Chandler requested to merge wc/metrics-server-envvar-rust into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Replace metrics FF with environment variable

We want a way to easily enable/disable the Rust native extension to prometheus-client-mmap. Initially we added the prom_metrics_rust feature flag in !119005 (merged), but when enabled on staging this did nothing.

It turns out that metrics run in a separate WEbrick process that does not have the ability to access feature flags. The approach taken in a similar situation in the past, !84567 (merged) was to check for an environment variable, so we replace the FF with a check against environment variable GITLAB_RUST_METRICS_EXTENSION.

This is less ergonomic than feature flags, but is the simplest option to get things moving.

How to set up and validate locally

  1. Enable sidekiq and web exporters in GDK and reconfigure:
    gitlab:
      monitoring:
        sidekiq_exporter:
          enabled: true
        web_exporter:
          enabled: true
  2. Add GITLAB_RUST_METRICS_EXTENSION=true to Procfile for rails-web and rails-background-jobs
  3. curl localhost:<EXPORTER_PORT>/metrics and confirm metrics are returned

MR acceptance checklist

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

Merge request reports