Commit 28e7a1de authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Mayra Cabrera

Add missing feature flag definition files

Add missing definition files for some feature flags
parent 8816566a
---
name: prometheus_metrics_method_instrumentation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4304
rollout_issue_url:
milestone: '10.5'
type: ops
group:
default_enabled: false
---
name: prometheus_metrics_view_instrumentation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4304
rollout_issue_url:
milestone: '10.5'
type: ops
group:
default_enabled: false
...@@ -57,7 +57,7 @@ class Feature ...@@ -57,7 +57,7 @@ class Feature
# use `default_enabled: true` to default the flag to being `enabled` # use `default_enabled: true` to default the flag to being `enabled`
# unless set explicitly. The default is `disabled` # unless set explicitly. The default is `disabled`
# TODO: remove the `default_enabled:` and read it from the `defintion_yaml` # TODO: remove the `default_enabled:` and read it from the `defintion_yaml`
# check: https://gitlab.com/gitlab-org/gitlab/-/issues/30228 # check: https://gitlab.com/gitlab-org/gitlab/-/issues/271275
def enabled?(key, thing = nil, type: :development, default_enabled: false) def enabled?(key, thing = nil, type: :development, default_enabled: false)
if check_feature_flags_definition? if check_feature_flags_definition?
if thing && !thing.respond_to?(:flipper_id) if thing && !thing.respond_to?(:flipper_id)
...@@ -65,11 +65,11 @@ class Feature ...@@ -65,11 +65,11 @@ class Feature
"The thing '#{thing.class.name}' for feature flag '#{key}' needs to include `FeatureGate` or implement `flipper_id`" "The thing '#{thing.class.name}' for feature flag '#{key}' needs to include `FeatureGate` or implement `flipper_id`"
end end
Feature::Definition.valid_usage!(key, type: type, default_enabled: default_enabled) Feature::Definition.valid_usage!(key, type: type, default_enabled: :yaml)
end end
# If `default_enabled: :yaml` we fetch the value from the YAML definition instead. # TODO: Remove rubocop disable comment once `default_enabled` argument is removed https://gitlab.com/gitlab-org/gitlab/-/issues/271275
default_enabled = Feature::Definition.default_enabled?(key) if default_enabled == :yaml default_enabled = Feature::Definition.default_enabled?(key) # rubocop:disable Lint/ShadowedArgument
# During setup the database does not exist yet. So we haven't stored a value # During setup the database does not exist yet. So we haven't stored a value
# for the feature yet and return the default. # for the feature yet and return the default.
......
...@@ -15,6 +15,7 @@ RSpec.describe 'Graphql Field feature flags' do ...@@ -15,6 +15,7 @@ RSpec.describe 'Graphql Field feature flags' do
before do before do
skip_feature_flags_yaml_validation skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end end
subject { result } subject { result }
......
...@@ -128,6 +128,7 @@ RSpec.describe Types::BaseField do ...@@ -128,6 +128,7 @@ RSpec.describe Types::BaseField do
before do before do
skip_feature_flags_yaml_validation skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end end
it 'returns false if the feature is not enabled' do it 'returns false if the feature is not enabled' do
......
...@@ -183,6 +183,7 @@ RSpec.describe API::Helpers do ...@@ -183,6 +183,7 @@ RSpec.describe API::Helpers do
before do before do
skip_feature_flags_yaml_validation skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end end
context 'with feature enabled' do context 'with feature enabled' do
......
...@@ -8,6 +8,7 @@ RSpec.describe Feature::Gitaly do ...@@ -8,6 +8,7 @@ RSpec.describe Feature::Gitaly do
before do before do
skip_feature_flags_yaml_validation skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end end
describe ".enabled?" do describe ".enabled?" do
......
This diff is collapsed.
...@@ -12,6 +12,7 @@ RSpec.describe Gitlab::GonHelper do ...@@ -12,6 +12,7 @@ RSpec.describe Gitlab::GonHelper do
describe '#push_frontend_feature_flag' do describe '#push_frontend_feature_flag' do
before do before do
skip_feature_flags_yaml_validation skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end end
it 'pushes a feature flag to the frontend' do it 'pushes a feature flag to the frontend' do
......
...@@ -102,6 +102,11 @@ RSpec.describe Gitlab::Metrics::Methods do ...@@ -102,6 +102,11 @@ RSpec.describe Gitlab::Metrics::Methods do
let(:feature_name) { :some_metric_feature } let(:feature_name) { :some_metric_feature }
let(:metric) { call_fetch_metric_method(docstring: docstring, with_feature: feature_name) } let(:metric) { call_fetch_metric_method(docstring: docstring, with_feature: feature_name) }
before do
skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end
context 'when feature is enabled' do context 'when feature is enabled' do
before do before do
stub_feature_flags(feature_name => true) stub_feature_flags(feature_name => true)
......
...@@ -54,6 +54,11 @@ RSpec.describe Gitlab::Metrics do ...@@ -54,6 +54,11 @@ RSpec.describe Gitlab::Metrics do
end end
describe '.measure' do describe '.measure' do
before do
skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end
context 'without a transaction' do context 'without a transaction' do
it 'returns the return value of the block' do it 'returns the return value of the block' do
val = described_class.measure(:foo) { 10 } val = described_class.measure(:foo) { 10 }
......
...@@ -438,6 +438,8 @@ RSpec.describe API::Features, stub_feature_flags: false do ...@@ -438,6 +438,8 @@ RSpec.describe API::Features, stub_feature_flags: false do
context 'when the gate value was set' do context 'when the gate value was set' do
before do before do
skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
Feature.enable(feature_name) Feature.enable(feature_name)
end end
......
...@@ -73,6 +73,7 @@ RSpec.describe API::UsageData do ...@@ -73,6 +73,7 @@ RSpec.describe API::UsageData do
context 'with unknown event' do context 'with unknown event' do
before do before do
skip_feature_flags_yaml_validation skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end end
it 'returns status ok' do it 'returns status ok' do
...@@ -149,6 +150,7 @@ RSpec.describe API::UsageData do ...@@ -149,6 +150,7 @@ RSpec.describe API::UsageData do
context 'with unknown event' do context 'with unknown event' do
before do before do
skip_feature_flags_yaml_validation skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
end end
it 'returns status ok' do it 'returns status ok' do
......
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