Commit a077b345 authored by Chase Southard's avatar Chase Southard Committed by Ash McKenzie

Adds User Cap instrumentation

parent fcd59974
---
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
{
elasticsearch_enabled: alt_usage_data(fallback: nil) { ::Gitlab::CurrentSettings.elasticsearch_search? },
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
......
# 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
it 'gathers service_ping_features_enabled' do
expect(subject[:settings][:service_ping_features_enabled]).to eq(Gitlab::CurrentSettings.usage_ping_features_enabled)
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
......
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