Skip to content
  • Rodrigo Tomonari's avatar
    Enhance observability for exclusive locks · 884cca9e
    Rodrigo Tomonari authored
    This commit introduces instrumentation for exclusive locks within the
    modules `Gitlab::ExclusiveLeaseGuard` and
    `Gitlab::ExclusiveLeaseHelpers`, enabling better monitoring and
    visibility into lock usage.
    
    When utilizing the `Gitlab::ExclusiveLeaseHelpers#in_lock` method, the
    following metrics are now tracked:
    - exclusive_lock_count`
    - exclusive_lock_wait_duration_s
    - exclusive_lock_hold_duration_s
    
    Similarly, when using the
    `Gitlab::ExclusiveLeaseHelpers#try_obtain_lease` method, the following
    metrics are captured:
    - exclusive_lock_count
    - exclusive_lock_hold_duration_s
    
    Notably, in the latter method, `exclusive_lock_wait_duration_s` is not
    captured as the method returns immediately if the lease is already held,
    thus no waiting time is incurred.
    884cca9e