Enhance observability for exclusive locks
What does this MR do and why?
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.
Related to: gitlab-com/gl-infra/scalability#2788 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.