diff --git a/ee/spec/requests/api/experiments_spec.rb b/ee/spec/requests/api/experiments_spec.rb index 6425c72d6582a0ade5ffb4bcf8cef5a07bd1f924..2312f43b14cd941e48e1d3744bed009844bd9f78 100644 --- a/ee/spec/requests/api/experiments_spec.rb +++ b/ee/spec/requests/api/experiments_spec.rb @@ -119,7 +119,7 @@ # Yes, we really do want to test this and the only way to get here # is by calling a private method. - expect(Gitlab::Tracking.send(:snowplow)).to receive(:event).with( + expect(Gitlab::Tracking.send(:tracker)).to receive(:event).with( 'null_hypothesis', 'assignment', label: nil, diff --git a/lib/gitlab/tracking.rb b/lib/gitlab/tracking.rb index 0e7812d08b8aa5f30e701fcbb4ecbb232e8f1a19..ae3f02c8c1ce0a75297a2bed632b17767631be7c 100644 --- a/lib/gitlab/tracking.rb +++ b/lib/gitlab/tracking.rb @@ -4,13 +4,13 @@ module Gitlab module Tracking class << self def enabled? - snowplow.enabled? + tracker.enabled? end def event(category, action, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil, **extra) # rubocop:disable Metrics/ParameterLists contexts = [Tracking::StandardContext.new(project: project, user: user, namespace: namespace, **extra).to_context, *context] - snowplow.event(category, action, label: label, property: property, value: value, context: contexts) + tracker.event(category, action, label: label, property: property, value: value, context: contexts) rescue StandardError => error Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error, snowplow_category: category, snowplow_action: action) end @@ -31,11 +31,11 @@ def dispatch_from_definition(definition, **event_data) end def options(group) - snowplow.options(group) + tracker.options(group) end def collector_hostname - snowplow.hostname + tracker.hostname end def snowplow_micro_enabled? @@ -44,12 +44,12 @@ def snowplow_micro_enabled? private - def snowplow - @snowplow ||= if snowplow_micro_enabled? - Gitlab::Tracking::Destinations::SnowplowMicro.new - else - Gitlab::Tracking::Destinations::Snowplow.new - end + def tracker + @tracker ||= if snowplow_micro_enabled? + Gitlab::Tracking::Destinations::SnowplowMicro.new + else + Gitlab::Tracking::Destinations::Snowplow.new + end end end end diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index cc973be8be9c730fc786b47c39ab29d7c24743c8..a99e3b0a7f23ed23e9447917b41cae73932b53c1 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -10,11 +10,11 @@ stub_application_setting(snowplow_cookie_domain: '.gitfoo.com') stub_application_setting(snowplow_app_id: '_abc123_') - described_class.instance_variable_set("@snowplow", nil) + described_class.instance_variable_set("@tracker", nil) end after do - described_class.instance_variable_set("@snowplow", nil) + described_class.instance_variable_set("@tracker", nil) end describe '.options' do diff --git a/spec/support/snowplow.rb b/spec/support/snowplow.rb index e58be667b37e3af812dc759f1e4ec21ac41b9478..d600bf008b01d6dcaa6252d5845d5f25f3f1c87a 100644 --- a/spec/support/snowplow.rb +++ b/spec/support/snowplow.rb @@ -11,6 +11,6 @@ end config.after(:each, :snowplow) do - Gitlab::Tracking.send(:snowplow).send(:tracker).flush + Gitlab::Tracking.send(:tracker).send(:tracker).flush end end