Enhance observability for exclusive locks
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.
显示
- app/services/concerns/exclusive_lease_guard.rb 4 个添加, 0 个删除app/services/concerns/exclusive_lease_guard.rb
- lib/gitlab/exclusive_lease_helpers.rb 21 个添加, 2 个删除lib/gitlab/exclusive_lease_helpers.rb
- lib/gitlab/instrumentation/exclusive_lock.rb 54 个添加, 0 个删除lib/gitlab/instrumentation/exclusive_lock.rb
- lib/gitlab/instrumentation_helper.rb 9 个添加, 0 个删除lib/gitlab/instrumentation_helper.rb
- spec/lib/gitlab/exclusive_lease_helpers_spec.rb 33 个添加, 0 个删除spec/lib/gitlab/exclusive_lease_helpers_spec.rb
- spec/lib/gitlab/instrumentation/exclusive_lock_spec.rb 82 个添加, 0 个删除spec/lib/gitlab/instrumentation/exclusive_lock_spec.rb
- spec/lib/gitlab/instrumentation_helper_spec.rb 32 个添加, 0 个删除spec/lib/gitlab/instrumentation_helper_spec.rb
- spec/services/concerns/exclusive_lease_guard_spec.rb 44 个添加, 0 个删除spec/services/concerns/exclusive_lease_guard_spec.rb
加载中
想要评论请 注册 或 登录