Skip to content
代码片段 群组 项目
提交 6e9f4627 编辑于 作者: Jan Provaznik's avatar Jan Provaznik
浏览文件

Merge branch 'refactor/tracking_tracker' into 'master'

Rename tracker in Gitlab::Tracking

See merge request gitlab-org/gitlab!91013
No related branches found
No related tags found
无相关合并请求
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
# Yes, we really do want to test this and the only way to get here # Yes, we really do want to test this and the only way to get here
# is by calling a private method. # 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', 'null_hypothesis',
'assignment', 'assignment',
label: nil, label: nil,
......
...@@ -4,13 +4,13 @@ module Gitlab ...@@ -4,13 +4,13 @@ module Gitlab
module Tracking module Tracking
class << self class << self
def enabled? def enabled?
snowplow.enabled? tracker.enabled?
end end
def event(category, action, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil, **extra) # rubocop:disable Metrics/ParameterLists 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] 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 rescue StandardError => error
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error, snowplow_category: category, snowplow_action: action) Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error, snowplow_category: category, snowplow_action: action)
end end
...@@ -31,11 +31,11 @@ def dispatch_from_definition(definition, **event_data) ...@@ -31,11 +31,11 @@ def dispatch_from_definition(definition, **event_data)
end end
def options(group) def options(group)
snowplow.options(group) tracker.options(group)
end end
def collector_hostname def collector_hostname
snowplow.hostname tracker.hostname
end end
def snowplow_micro_enabled? def snowplow_micro_enabled?
...@@ -44,12 +44,12 @@ def snowplow_micro_enabled? ...@@ -44,12 +44,12 @@ def snowplow_micro_enabled?
private private
def snowplow def tracker
@snowplow ||= if snowplow_micro_enabled? @tracker ||= if snowplow_micro_enabled?
Gitlab::Tracking::Destinations::SnowplowMicro.new Gitlab::Tracking::Destinations::SnowplowMicro.new
else else
Gitlab::Tracking::Destinations::Snowplow.new Gitlab::Tracking::Destinations::Snowplow.new
end end
end end
end end
end end
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
stub_application_setting(snowplow_cookie_domain: '.gitfoo.com') stub_application_setting(snowplow_cookie_domain: '.gitfoo.com')
stub_application_setting(snowplow_app_id: '_abc123_') stub_application_setting(snowplow_app_id: '_abc123_')
described_class.instance_variable_set("@snowplow", nil) described_class.instance_variable_set("@tracker", nil)
end end
after do after do
described_class.instance_variable_set("@snowplow", nil) described_class.instance_variable_set("@tracker", nil)
end end
describe '.options' do describe '.options' do
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
end end
config.after(:each, :snowplow) do config.after(:each, :snowplow) do
Gitlab::Tracking.send(:snowplow).send(:tracker).flush Gitlab::Tracking.send(:tracker).send(:tracker).flush
end end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册