Commit 17414d5d authored by Rajendra Kadam's avatar Rajendra Kadam

Add metadata to snowplow events

Now we have user, project and namespace info
in our backend snowplow events. Fixes spec
for the mentioned changes.
parent 9a2d5688
......@@ -26,7 +26,7 @@ class Groups::EmailCampaignsController < Groups::ApplicationController
}
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
::Users::InProductMarketingEmail.save_cta_click(current_user, @track, @series)
end
......
......@@ -67,7 +67,7 @@ class ProfilesController < Profiles::ApplicationController
.order("created_at DESC")
.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
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -65,7 +65,7 @@ module Projects
return unless external_url_previous_change
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
def alerting_params
......
......@@ -29,7 +29,7 @@ module EE
return unless external_url_previous_change
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
......
......@@ -110,7 +110,8 @@ RSpec.describe ProfilesController, :request_store do
expect_snowplow_event(
category: 'ProfilesController',
action: 'search_audit_event'
action: 'search_audit_event',
user: user
)
end
end
......
......@@ -509,7 +509,10 @@ RSpec.describe Projects::Settings::OperationsController do
it 'tracks an event' do
expect_snowplow_event(
category: 'project:operations:tracing',
action: 'external_url_populated'
action: 'external_url_populated',
user: user,
project: project,
namespace: project.namespace
)
end
end
......
......@@ -52,7 +52,9 @@ RSpec.describe Groups::EmailCampaignsController do
context: [{
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 }
}]
}],
user: user,
namespace: group
)
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