Commit f79034e5 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch 'cat-remove-geo-proxy-events-ff' into 'master'

Remove Geo proxying metrics feature flag

See merge request gitlab-org/gitlab!80018
parents 3340617d ca876916
---
name: track_geo_proxy_events
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76587
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/348414
milestone: '14.7'
type: development
group: group::geo
default_enabled: true
......@@ -8,8 +8,7 @@ module GeoInstrumentation
end
def track_geo_proxy_event
return unless Feature.enabled?(:track_geo_proxy_events, default_enabled: :yaml) && ::Gitlab::Geo.proxied_request?(request.env)
return unless current_user
return unless ::Gitlab::Geo.proxied_request?(request.env) && current_user
Gitlab::UsageDataCounters::HLLRedisCounter.track_event('g_geo_proxied_requests', values: current_user.id)
end
......
......@@ -19,9 +19,9 @@ RSpec.describe GeoInstrumentation do
end
describe '.track_geo_proxy_event' do
context 'when the track_geo_proxy feature flag is disabled' do
context 'when the request is not proxied' do
before do
stub_feature_flags(track_geo_proxy_events: false)
allow(::Gitlab::Geo).to receive(:proxied_request?).and_return(false)
end
it 'does not track an event' do
......@@ -30,38 +30,25 @@ RSpec.describe GeoInstrumentation do
end
end
context 'when the track_geo_proxy feature flag is enabled' do
context 'when the request is not proxied' do
before do
allow(::Gitlab::Geo).to receive(:proxied_request?).and_return(false)
end
context 'when the request is proxied' do
before do
allow(::Gitlab::Geo).to receive(:proxied_request?).and_return(true)
end
it 'does not track an event' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event)
context 'when logged in' do
it 'tracks a HLL event for unique geo proxied requests' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.to receive(:track_event).with('g_geo_proxied_requests', values: user.id)
get :show
end
end
context 'when the request is proxied' do
before do
allow(::Gitlab::Geo).to receive(:proxied_request?).and_return(true)
end
context 'when logged in' do
it 'tracks a HLL event for unique geo proxied requests' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.to receive(:track_event).with('g_geo_proxied_requests', values: user.id)
get :show
end
end
context 'when not logged in' do
let(:user) { nil }
context 'when not logged in' do
let(:user) { nil }
it 'does not track an event' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event)
get :show
end
it 'does not track an event' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event)
get :show
end
end
end
......
......@@ -382,7 +382,6 @@
category: geo
redis_slot: geo
aggregation: daily
feature_flag: track_geo_proxy_events
# Growth
- name: users_clicking_registration_features_offer
category: growth
......
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