Commit 02755a3e authored by alinamihaila's avatar alinamihaila

Add CountUsersUsingApproveQuickActionMetric to usage data

parent cfdd2aca
......@@ -9,9 +9,10 @@ value_type: number
status: data_available
time_frame: 28d
data_source: redis_hll
instrumentation_class: 'Gitlab::Usage::Metrics::Instrumentations::CountUsersUsingApproveQuickActionMetric'
distribution:
- ce
- ee
- ee
tier:
- free
- premium
......
......@@ -9,10 +9,11 @@ value_type: number
status: data_available
time_frame: 7d
data_source: redis_hll
instrumentation_class: 'Gitlab::Usage::Metrics::Instrumentations::CountUsersUsingApproveQuickActionMetric'
distribution:
- ce
- ee
- ee
tier:
- free
- premium
- ultimate
\ No newline at end of file
- ultimate
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CountUsersUsingApproveQuickActionMetric < RedisHLLMetric
event_names :i_quickactions_approve
end
end
end
end
end
......@@ -12,7 +12,7 @@ module Gitlab
# end
class << self
def event_names(events = nil)
@mentric_events = events
@metric_events = events
end
attr_reader :metric_events
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CountUsersUsingApproveQuickActionMetric, :clean_gitlab_redis_shared_state do
before do
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 1, time: 1.week.ago)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 1, time: 2.weeks.ago)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 2, time: 2.weeks.ago)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 2, time: 2.months.ago)
end
it_behaves_like 'a correct instrumented metric value', { time_frame: '28d', data_source: 'redis_hll' }, 2
it_behaves_like 'a correct instrumented metric value', { time_frame: '7d', data_source: 'redis_hll' }, 1
end
......@@ -20,6 +20,11 @@ RSpec.describe Gitlab::UsageDataMetrics do
it 'includes top level keys' do
expect(subject).to include(:uuid)
end
it 'includes i_quickactions_approve monthly and weekly key' do
expect(subject[:redis_hll_counters][:quickactions]).to include(:i_quickactions_approve_monthly)
expect(subject[:redis_hll_counters][:quickactions]).to include(:i_quickactions_approve_weekly)
end
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