diff options
Diffstat (limited to 'lib/gitlab/tracking.rb')
-rw-r--r-- | lib/gitlab/tracking.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/gitlab/tracking.rb b/lib/gitlab/tracking.rb index 0e7812d08b8..04745bafe7c 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,25 +31,27 @@ module Gitlab end def options(group) - snowplow.options(group) + tracker.options(group) end def collector_hostname - snowplow.hostname + tracker.hostname end def snowplow_micro_enabled? - Rails.env.development? && Gitlab::Utils.to_boolean(ENV['SNOWPLOW_MICRO_ENABLE']) + Rails.env.development? && Gitlab.config.snowplow_micro.enabled + rescue Settingslogic::MissingSetting + Gitlab::Utils.to_boolean(ENV['SNOWPLOW_MICRO_ENABLE']) end 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 |