Commit 3d309089 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '338461-migrate-subscription-metrics-to-use-instrumentation-classes' into 'master'

Migrate historical_max_users metric to Instrumentation class

See merge request gitlab-org/gitlab!72350
parents e3fb40d1 b3b33281
...@@ -7,6 +7,7 @@ product_group: group::license ...@@ -7,6 +7,7 @@ product_group: group::license
product_category: license product_category: license
value_type: number value_type: number
status: active status: active
instrumentation_class: HistoricalMaxUsersMetric
time_frame: none time_frame: none
data_source: database data_source: database
data_category: subscription data_category: subscription
......
...@@ -93,7 +93,7 @@ module EE ...@@ -93,7 +93,7 @@ module EE
usage_data[:license_md5] = license.md5 usage_data[:license_md5] = license.md5
usage_data[:license_id] = license.license_id usage_data[:license_id] = license.license_id
# rubocop: disable UsageData/LargeTable # rubocop: disable UsageData/LargeTable
usage_data[:historical_max_users] = license.historical_max usage_data[:historical_max_users] = add_metric("HistoricalMaxUsersMetric")
# rubocop: enable UsageData/LargeTable # rubocop: enable UsageData/LargeTable
usage_data[:licensee] = add_metric("LicenseeMetrics") usage_data[:licensee] = add_metric("LicenseeMetrics")
usage_data[:license_user_count] = license.restricted_user_count usage_data[:license_user_count] = license.restricted_user_count
......
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class HistoricalMaxUsersMetric < ::Gitlab::Usage::Metrics::Instrumentations::GenericMetric
value do
::License.current.historical_max
end
end
end
end
end
end
...@@ -15,7 +15,7 @@ RSpec.describe Gitlab::UsageDataNonSqlMetrics do ...@@ -15,7 +15,7 @@ RSpec.describe Gitlab::UsageDataNonSqlMetrics do
described_class.uncached_data described_class.uncached_data
end end
expect(recorder.count).to eq(54) expect(recorder.count).to eq(55)
end end
end end
end end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::HistoricalMaxUsersMetric do
it_behaves_like 'a correct instrumented metric value', { time_frame: 'none', data_source: 'ruby' } do
let(:expected_value) { ::License.current.historical_max }
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