Commit ced2291c authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'add_active_user_instr_metric' into 'master'

Add active_user_count instrumentations metric

See merge request gitlab-org/gitlab!72164
parents f746aadb 338226ec
...@@ -10,6 +10,7 @@ status: active ...@@ -10,6 +10,7 @@ status: active
milestone: "<13.9" milestone: "<13.9"
data_category: subscription data_category: subscription
time_frame: none time_frame: none
instrumentation_class: ActiveUserCountMetric
data_source: database data_source: database
distribution: distribution:
- ce - ce
......
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class ActiveUserCountMetric < DatabaseMetric
operation :count
relation { User.active }
end
end
end
end
end
...@@ -76,7 +76,7 @@ module Gitlab ...@@ -76,7 +76,7 @@ module Gitlab
hostname: add_metric('HostnameMetric'), hostname: add_metric('HostnameMetric'),
version: alt_usage_data { Gitlab::VERSION }, version: alt_usage_data { Gitlab::VERSION },
installation_type: alt_usage_data { installation_type }, installation_type: alt_usage_data { installation_type },
active_user_count: count(User.active), active_user_count: add_metric('ActiveUserCountMetric'),
edition: 'CE' edition: 'CE'
} }
end end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::ActiveUserCountMetric do
before do
create(:user)
end
it_behaves_like 'a correct instrumented metric value', { time_frame: 'none', data_source: 'ruby' } do
let(:expected_value) { ::User.active.count }
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