Commit df91aafe authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'user_cap_instrumentation' into 'master'

Adds User Cap instrumentation

See merge request gitlab-org/gitlab!71786
parents 331db0e9 a077b345
---
key_path: user_cap_feature_enabled
description: Whether User Cap feature is enabled
product_section: fulfillment
product_stage: fulfillment
product_group: group::utilization
product_category: utilization
value_type: number
status: active
milestone: "14.4"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71786
instrumentation_class: UserCapSettingEnabledMetric
time_frame: none
data_source: database
data_category: optional
distribution:
- ee
tier:
- premium
- ultimate
...@@ -73,7 +73,8 @@ module EE ...@@ -73,7 +73,8 @@ module EE
{ {
elasticsearch_enabled: alt_usage_data(fallback: nil) { ::Gitlab::CurrentSettings.elasticsearch_search? }, elasticsearch_enabled: alt_usage_data(fallback: nil) { ::Gitlab::CurrentSettings.elasticsearch_search? },
license_trial_ends_on: alt_usage_data(fallback: nil) { License.trial_ends_on }, license_trial_ends_on: alt_usage_data(fallback: nil) { License.trial_ends_on },
geo_enabled: alt_usage_data(fallback: nil) { ::Gitlab::Geo.enabled? } geo_enabled: alt_usage_data(fallback: nil) { ::Gitlab::Geo.enabled? },
user_cap_feature_enabled: add_metric('UserCapSettingEnabledMetric', time_frame: 'none')
} }
end end
......
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class UserCapSettingEnabledMetric < ::Gitlab::Usage::Metrics::Instrumentations::GenericMetric
value do
::Gitlab::CurrentSettings.new_user_signups_cap
end
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ::Gitlab::Usage::Metrics::Instrumentations::UserCapSettingEnabledMetric do
using RSpec::Parameterized::TableSyntax
where(:user_cap_feature_enabled, :expected_value) do
42 | 42
-1 | -1
end
with_them do
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
stub_application_setting(new_user_signups_cap: user_cap_feature_enabled)
end
it_behaves_like 'a correct instrumented metric value', {}
end
end
...@@ -1074,6 +1074,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -1074,6 +1074,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
it 'gathers service_ping_features_enabled' do it 'gathers service_ping_features_enabled' do
expect(subject[:settings][:service_ping_features_enabled]).to eq(Gitlab::CurrentSettings.usage_ping_features_enabled) expect(subject[:settings][:service_ping_features_enabled]).to eq(Gitlab::CurrentSettings.usage_ping_features_enabled)
end end
it 'gathers user_cap_feature_enabled' do
expect(subject[:settings][:user_cap_feature_enabled]).to eq(Gitlab::CurrentSettings.new_user_signups_cap)
end
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