Commit e83f1da7 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '37456-define-memory-usage-histogram' into 'master'

Define a memory usage histogram for diff caching

See merge request gitlab-org/gitlab!24012
parents 61618c71 b4dcc665
......@@ -3,6 +3,7 @@
module Gitlab
module Diff
class HighlightCache
include Gitlab::Metrics::Methods
include Gitlab::Utils::StrongMemoize
EXPIRATION = 1.week
......@@ -11,6 +12,11 @@ module Gitlab
delegate :diffable, to: :@diff_collection
delegate :diff_options, to: :@diff_collection
define_histogram :gitlab_redis_diff_caching_memory_usage_bytes do
docstring 'Redis diff caching memory usage by key'
buckets [100, 1000, 10000, 100000, 1000000, 10000000]
end
def initialize(diff_collection)
@diff_collection = diff_collection
end
......
......@@ -144,4 +144,10 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
cache.clear
end
end
describe 'metrics' do
it 'defines :gitlab_redis_diff_caching_memory_usage_bytes histogram' do
expect(described_class).to respond_to(:gitlab_redis_diff_caching_memory_usage_bytes)
end
end
end
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