Commit 872d67b9 authored by alinamihaila's avatar alinamihaila

Add metric operation to generic and redis_hll metrics

parent 00622aef
1# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab
module Usage module Usage
...@@ -55,10 +55,6 @@ module Gitlab ...@@ -55,10 +55,6 @@ module Gitlab
) )
end end
def relation
self.class.metric_relation.call.where(time_constraints)
end
private private
def relation def relation
......
...@@ -13,6 +13,9 @@ module Gitlab ...@@ -13,6 +13,9 @@ module Gitlab
# end # end
# end # end
class << self class << self
attr_reader :metric_operation
@metric_operation = :alt
def value(&block) def value(&block)
@metric_value = block @metric_value = block
end end
...@@ -28,9 +31,7 @@ module Gitlab ...@@ -28,9 +31,7 @@ module Gitlab
def suggested_name def suggested_name
Gitlab::Usage::Metrics::NameSuggestion.for( Gitlab::Usage::Metrics::NameSuggestion.for(
:alt, self.class.metric_operation
relation: nil,
column: nil
) )
end end
end end
......
...@@ -12,6 +12,11 @@ module Gitlab ...@@ -12,6 +12,11 @@ module Gitlab
# events: # events:
# - g_analytics_valuestream # - g_analytics_valuestream
# end # end
class << self
attr_reader :metric_operation
@metric_operation = :redis
end
def initialize(time_frame:, options: {}) def initialize(time_frame:, options: {})
super super
...@@ -32,9 +37,7 @@ module Gitlab ...@@ -32,9 +37,7 @@ module Gitlab
def suggested_name def suggested_name
Gitlab::Usage::Metrics::NameSuggestion.for( Gitlab::Usage::Metrics::NameSuggestion.for(
:redis, self.class.metric_operation
relation: nil,
column: nil
) )
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