diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-13 15:19:50 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-13 15:31:13 +0200 |
commit | 3b9edce803c91b5f51675291fdf22f1159cea456 (patch) | |
tree | 3740a3f04aae3923663badf749316af1d845dab8 /app/services | |
parent | f026e53c4df5b0b3bb7435c05d3c8662afe45881 (diff) | |
download | gitlab-ce-3b9edce803c91b5f51675291fdf22f1159cea456.tar.gz |
Instrument the HousekeepingService classinstrument-house-keeping
This allows us to track how much time is spent in updating the
"pushes_since_gc" column as well as the time needed to obtain the lease.
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/housekeeping_service.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/services/projects/housekeeping_service.rb b/app/services/projects/housekeeping_service.rb index a0973c5d260..3b7c36f0908 100644 --- a/app/services/projects/housekeeping_service.rb +++ b/app/services/projects/housekeeping_service.rb @@ -26,7 +26,9 @@ module Projects GitlabShellOneShotWorker.perform_async(:gc, @project.path_with_namespace) ensure - @project.update_column(:pushes_since_gc, 0) + Gitlab::Metrics.measure(:reset_pushes_since_gc) do + @project.update_column(:pushes_since_gc, 0) + end end def needed? @@ -34,14 +36,18 @@ module Projects end def increment! - @project.increment!(:pushes_since_gc) + Gitlab::Metrics.measure(:increment_pushes_since_gc) do + @project.increment!(:pushes_since_gc) + end end private def try_obtain_lease - lease = ::Gitlab::ExclusiveLease.new("project_housekeeping:#{@project.id}", timeout: LEASE_TIMEOUT) - lease.try_obtain + Gitlab::Metrics.measure(:obtain_housekeeping_lease) do + lease = ::Gitlab::ExclusiveLease.new("project_housekeeping:#{@project.id}", timeout: LEASE_TIMEOUT) + lease.try_obtain + end end end end |