Commit 1b4faf14 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '10io-change-cleanup-policies-caching-hit-ratio-format' into 'master'

Cleanup policies: format cleanup cache hit ratio

See merge request gitlab-org/gitlab!73730
parents 5b7c560b 535373d6
......@@ -159,7 +159,10 @@ module ContainerExpirationPolicies
return unless tags_count && cached_tags_count && tags_count != 0
log_extra_metadata_on_done(:cleanup_tags_service_cache_hit_ratio, cached_tags_count / tags_count.to_f)
ratio = cached_tags_count / tags_count.to_f
ratio_as_percentage = (ratio * 100).round(2)
log_extra_metadata_on_done(:cleanup_tags_service_cache_hit_ratio, ratio_as_percentage)
end
def log_truncate(result)
......
......@@ -82,8 +82,9 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
nil | 10 | nil
0 | 5 | nil
10 | 0 | 0
10 | 5 | 0.5
3 | 10 | (10 / 3.to_f)
10 | 5 | 50.0
17 | 3 | 17.65
3 | 10 | 333.33
end
with_them do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment