Add GVL wait time metrics to Sidekiq structured logs

What does this MR do and why?

Move GVL instrumentation from ServerMetrics into InstrumentationLogger so that gvl_thread_wait_s and gvl_process_wait_s flow into the structured job completion logs via the standard instrumentation pipeline.

ServerMetrics now reads GVL values from the instrumentation hash for Prometheus, consistent with how it consumes gitaly/redis/elasticsearch metrics.

References

See gitlab-com/gl-infra/tenant-scale/tenant-services/team#384 (closed)

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. In gdk.yml, make sure you have the prometheus and the sidekiq exporter enabled (run gdk reconfigure && gdk.restart after making these changes):

    # gdk.yml
    prometheus:
      enabled: true
    gitlab:
      lefthook_enabled: false
        rails_background_jobs:
          sidekiq_exporter_enabled: true

    If you are using gdk.test as your GDK host, edit config/gitlab.yml to use localhost instead (and gdk restart rails-background-jobs afterwards):

     sidekiq_exporter:
       enabled: true
    -  address: gdk.test
    +  address: localhost
       port: 3807
  2. In rails console enable the feature flag

    Feature.enable(:enable_sidekiq_gvl_metrics)
  3. Tail sidekiq

    tail -f log/sidekiq.log | grep gvl

    See the results streaming in.

  4. Visit http://localhost:3807/metrics and observe the GVL metrics there

  5. Next, disable the flag

    Feature.disable(:enable_sidekiq_gvl_metrics)
  6. Observe that when tailing, the results eventually stop showing up in

    tail -f log/sidekiq.log | grep gvl

    and on http://localhost:3807/metrics

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Hordur Freyr Yngvason

Merge request reports

Loading
Loading