Commit 84dad215 authored by alinamihaila's avatar alinamihaila

Remove extra feature flag check

  - From lib/gitlab/utils/usage_data.rb
  - Check is done in Gitlab::UsageDataCounters::HLLRedisCounter
  - Add related feature flag to i_source_code_code_intelligence
  this was missing from the event definition
parent d648b282
...@@ -165,6 +165,7 @@ ...@@ -165,6 +165,7 @@
redis_slot: source_code redis_slot: source_code
category: source_code category: source_code
aggregation: daily aggregation: daily
feature_flag: usage_data_i_source_code_code_intelligence
# Incident management # Incident management
- name: incident_management_alert_status_changed - name: incident_management_alert_status_changed
redis_slot: incident_management redis_slot: incident_management
......
...@@ -127,8 +127,6 @@ module Gitlab ...@@ -127,8 +127,6 @@ module Gitlab
# @param event_name [String] the event name # @param event_name [String] the event name
# @param values [Array|String] the values counted # @param values [Array|String] the values counted
def track_usage_event(event_name, values) def track_usage_event(event_name, values)
return unless Feature.enabled?(:"usage_data_#{event_name}", default_enabled: true)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name.to_s, values: values) Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name.to_s, values: values)
end end
......
...@@ -344,38 +344,15 @@ RSpec.describe Gitlab::Utils::UsageData do ...@@ -344,38 +344,15 @@ RSpec.describe Gitlab::Utils::UsageData do
let(:value) { '9f302fea-f828-4ca9-aef4-e10bd723c0b3' } let(:value) { '9f302fea-f828-4ca9-aef4-e10bd723c0b3' }
let(:event_name) { 'incident_management_alert_status_changed' } let(:event_name) { 'incident_management_alert_status_changed' }
let(:unknown_event) { 'unknown' } let(:unknown_event) { 'unknown' }
let(:feature) { "usage_data_#{event_name}" }
before do it 'tracks redis hll event' do
skip_feature_flags_yaml_validation expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(event_name, values: value)
end
context 'with feature enabled' do
before do
stub_feature_flags(feature => true)
end
it 'tracks redis hll event' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(event_name, values: value)
described_class.track_usage_event(event_name, value)
end
it 'raise an error for unknown event' do described_class.track_usage_event(event_name, value)
expect { described_class.track_usage_event(unknown_event, value) }.to raise_error(Gitlab::UsageDataCounters::HLLRedisCounter::UnknownEvent)
end
end end
context 'with feature disabled' do it 'raise an error for unknown event' do
before do expect { described_class.track_usage_event(unknown_event, value) }.to raise_error(Gitlab::UsageDataCounters::HLLRedisCounter::UnknownEvent)
stub_feature_flags(feature => false)
end
it 'does not track event' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event)
described_class.track_usage_event(event_name, value)
end
end 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