Commit 33601c63 authored by João Cunha's avatar João Cunha Committed by João Alexandre Cunha

Add certificate_based_clusters FF to Service Ping

We want to have an idea if self-managed users will be turning this FF
off before we completely remove the feature that's behind the FF.

In this commit we:

- Add the metric YAML definition under settings key_path
- Add the Instrumentation class
- Add specs

Changelog: other
parent faea16cc
---
key_path: settings.certificate_based_clusters_ff
name: "certificate_based_clusters_ff"
description: "Certificate-based clusters feature flag"
product_section: ops
product_stage: configure
product_group: group::configure
product_category:
value_type: boolean
status: active
milestone: "14.9"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81311
time_frame: none
data_source: database
data_category: optional
instrumentation_class: CertBasedClustersFfMetric
performance_indicator_type: []
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CertBasedClustersFfMetric < GenericMetric
value do
Feature.enabled?(:certificate_based_clusters, default_enabled: :yaml, type: :ops)
end
end
end
end
end
end
......@@ -224,7 +224,8 @@ module Gitlab
collected_data_categories: add_metric('CollectedDataCategoriesMetric', time_frame: 'none'),
service_ping_features_enabled: add_metric('ServicePingFeaturesMetric', time_frame: 'none'),
snowplow_enabled: add_metric('SnowplowEnabledMetric', time_frame: 'none'),
snowplow_configured_to_gitlab_collector: add_metric('SnowplowConfiguredToGitlabCollectorMetric', time_frame: 'none')
snowplow_configured_to_gitlab_collector: add_metric('SnowplowConfiguredToGitlabCollectorMetric', time_frame: 'none'),
certificate_based_clusters_ff: add_metric('CertBasedClustersFfMetric')
}
}
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CertBasedClustersFfMetric do
context 'with FF enabled' do
it_behaves_like 'a correct instrumented metric value', { time_frame: '7d', data_source: 'database' } do
let(:expected_value) { true }
end
end
context 'with FF disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it_behaves_like 'a correct instrumented metric value', { time_frame: '7d', data_source: 'database' } do
let(:expected_value) { false }
end
end
end
......@@ -1100,6 +1100,20 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(subject[:settings][:user_cap_feature_enabled]).to eq(Gitlab::CurrentSettings.new_user_signups_cap)
end
it 'reports status of the certificate_based_clusters feature flag as true' do
expect(subject[:settings][:certificate_based_clusters_ff]).to eq(true)
end
context 'with certificate_based_clusters disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it 'reports status of the certificate_based_clusters feature flag as false' do
expect(subject[:settings][:certificate_based_clusters_ff]).to eq(false)
end
end
context 'snowplow stats' do
before do
stub_feature_flags(usage_data_instrumentation: false)
......
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