Commit 2fb59f80 authored by Markus Koller's avatar Markus Koller

Merge branch 'am-add-count-users-visiting-valuestream-metric' into 'master'

Add CountUsersUsingApproveQuickActionMetric

See merge request gitlab-org/gitlab!60089
parents b048e3be 02755a3e
......@@ -9,6 +9,7 @@ value_type: number
status: data_available
time_frame: 28d
data_source: redis_hll
instrumentation_class: 'Gitlab::Usage::Metrics::Instrumentations::CountUsersUsingApproveQuickActionMetric'
distribution:
- ce
- ee
......
......@@ -9,6 +9,7 @@ value_type: number
status: data_available
time_frame: 7d
data_source: redis_hll
instrumentation_class: 'Gitlab::Usage::Metrics::Instrumentations::CountUsersUsingApproveQuickActionMetric'
distribution:
- ce
- ee
......
# 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
......@@ -25,6 +25,11 @@ RSpec.describe Gitlab::UsageDataMetrics do
it 'includes counts keys' do
expect(subject[:counts]).to include(:boards)
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