Commit c154e1a9 authored by Mark Chao's avatar Mark Chao

Merge branch 'gitlab-tracking-meta-2' into 'master'

Add user/project/namespace in snowplow tracking

See merge request gitlab-org/gitlab!62661
parents c6e57e5a 17414d5d
...@@ -26,7 +26,7 @@ class Groups::EmailCampaignsController < Groups::ApplicationController ...@@ -26,7 +26,7 @@ class Groups::EmailCampaignsController < Groups::ApplicationController
} }
context = SnowplowTracker::SelfDescribingJson.new(EMAIL_CAMPAIGNS_SCHEMA_URL, data) context = SnowplowTracker::SelfDescribingJson.new(EMAIL_CAMPAIGNS_SCHEMA_URL, data)
::Gitlab::Tracking.event(self.class.name, 'click', context: [context]) ::Gitlab::Tracking.event(self.class.name, 'click', context: [context], user: current_user, namespace: group)
else else
::Users::InProductMarketingEmail.save_cta_click(current_user, @track, @series) ::Users::InProductMarketingEmail.save_cta_click(current_user, @track, @series)
end end
......
...@@ -67,7 +67,7 @@ class ProfilesController < Profiles::ApplicationController ...@@ -67,7 +67,7 @@ class ProfilesController < Profiles::ApplicationController
.order("created_at DESC") .order("created_at DESC")
.page(params[:page]) .page(params[:page])
Gitlab::Tracking.event(self.class.name, 'search_audit_event') Gitlab::Tracking.event(self.class.name, 'search_audit_event', user: current_user)
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -65,7 +65,7 @@ module Projects ...@@ -65,7 +65,7 @@ module Projects
return unless external_url_previous_change return unless external_url_previous_change
return unless external_url_previous_change[0].blank? && external_url_previous_change[1].present? return unless external_url_previous_change[0].blank? && external_url_previous_change[1].present?
::Gitlab::Tracking.event('project:operations:tracing', 'external_url_populated') ::Gitlab::Tracking.event('project:operations:tracing', 'external_url_populated', user: current_user, project: project, namespace: project.namespace)
end end
def alerting_params def alerting_params
......
...@@ -29,7 +29,7 @@ module EE ...@@ -29,7 +29,7 @@ module EE
return unless external_url_previous_change return unless external_url_previous_change
return unless external_url_previous_change[0].blank? && external_url_previous_change[1].present? return unless external_url_previous_change[0].blank? && external_url_previous_change[1].present?
::Gitlab::Tracking.event('project:operations:tracing', "external_url_populated") ::Gitlab::Tracking.event('project:operations:tracing', "external_url_populated", user: current_user, project: project, namespace: project.namespace)
end end
end end
......
...@@ -110,7 +110,8 @@ RSpec.describe ProfilesController, :request_store do ...@@ -110,7 +110,8 @@ RSpec.describe ProfilesController, :request_store do
expect_snowplow_event( expect_snowplow_event(
category: 'ProfilesController', category: 'ProfilesController',
action: 'search_audit_event' action: 'search_audit_event',
user: user
) )
end end
end end
......
...@@ -509,7 +509,10 @@ RSpec.describe Projects::Settings::OperationsController do ...@@ -509,7 +509,10 @@ RSpec.describe Projects::Settings::OperationsController do
it 'tracks an event' do it 'tracks an event' do
expect_snowplow_event( expect_snowplow_event(
category: 'project:operations:tracing', category: 'project:operations:tracing',
action: 'external_url_populated' action: 'external_url_populated',
user: user,
project: project,
namespace: project.namespace
) )
end end
end end
......
...@@ -52,7 +52,9 @@ RSpec.describe Groups::EmailCampaignsController do ...@@ -52,7 +52,9 @@ RSpec.describe Groups::EmailCampaignsController do
context: [{ context: [{
schema: described_class::EMAIL_CAMPAIGNS_SCHEMA_URL, schema: described_class::EMAIL_CAMPAIGNS_SCHEMA_URL,
data: { namespace_id: group.id, series: series.to_i, subject_line: subject_line_text, track: track.to_s } data: { namespace_id: group.id, series: series.to_i, subject_line: subject_line_text, track: track.to_s }
}] }],
user: user,
namespace: group
) )
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