Commit 338226ec authored by Niko Belokolodov's avatar Niko Belokolodov

Migrate add_user_count metric to use instrumentation class

parent f21f76b8
......@@ -10,6 +10,7 @@ status: active
milestone: "<13.9"
data_category: subscription
time_frame: none
instrumentation_class: ActiveUserCountMetric
data_source: database
distribution:
- 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
hostname: add_metric('HostnameMetric'),
version: alt_usage_data { Gitlab::VERSION },
installation_type: alt_usage_data { installation_type },
active_user_count: count(User.active),
active_user_count: add_metric('ActiveUserCountMetric'),
edition: 'CE'
}
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