Commit 36f30dac authored by Markus Koller's avatar Markus Koller

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

Update tracking calls with user, namespace and project

See merge request gitlab-org/gitlab!63283
parents 4c75c7d2 ce5fadfe
...@@ -47,11 +47,11 @@ module Issues ...@@ -47,11 +47,11 @@ module Issues
attr_reader :issue attr_reader :issue
def track_meeting_added_event def track_meeting_added_event
::Gitlab::Tracking.event('IncidentManagement::ZoomIntegration', 'add_zoom_meeting', label: 'Issue ID', value: issue.id) ::Gitlab::Tracking.event('IncidentManagement::ZoomIntegration', 'add_zoom_meeting', label: 'Issue ID', value: issue.id, user: current_user, project: @project, namespace: @project.namespace)
end end
def track_meeting_removed_event def track_meeting_removed_event
::Gitlab::Tracking.event('IncidentManagement::ZoomIntegration', 'remove_zoom_meeting', label: 'Issue ID', value: issue.id) ::Gitlab::Tracking.event('IncidentManagement::ZoomIntegration', 'remove_zoom_meeting', label: 'Issue ID', value: issue.id, user: current_user, project: @project, namespace: @project.namespace)
end end
def add_zoom_meeting(link) def add_zoom_meeting(link)
......
...@@ -75,7 +75,7 @@ module Members ...@@ -75,7 +75,7 @@ module Members
def after_execute(member:) def after_execute(member:)
super super
Gitlab::Tracking.event(self.class.name, 'create_member', label: invite_source, property: tracking_property(member)) Gitlab::Tracking.event(self.class.name, 'create_member', label: invite_source, property: tracking_property(member), user: current_user)
end end
def invite_source def invite_source
......
...@@ -12,7 +12,7 @@ module GroupInviteMembers ...@@ -12,7 +12,7 @@ module GroupInviteMembers
result = Members::CreateService.new(current_user, invite_params).execute result = Members::CreateService.new(current_user, invite_params).execute
::Gitlab::Tracking.event(self.class.name, 'invite_members', label: 'new_group_form') if result[:status] == :success ::Gitlab::Tracking.event(self.class.name, 'invite_members', label: 'new_group_form', user: current_user) if result[:status] == :success
end end
def emails_param def emails_param
......
...@@ -52,7 +52,9 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat ...@@ -52,7 +52,9 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
def download_tracker_params def download_tracker_params
{ {
label: 'group_id', label: 'group_id',
value: @group.id value: @group.id,
user: current_user,
namespace: @group
} }
end end
end end
...@@ -19,7 +19,9 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl ...@@ -19,7 +19,9 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
def pageview_tracker_params def pageview_tracker_params
{ {
label: 'group_id', label: 'group_id',
value: @group.id value: @group.id,
user: current_user,
namespace: @group
} }
end end
end end
...@@ -66,7 +66,9 @@ RSpec.describe Groups::Analytics::CoverageReportsController do ...@@ -66,7 +66,9 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
category: described_class.name, category: described_class.name,
action: 'download_code_coverage_csv', action: 'download_code_coverage_csv',
label: 'group_id', label: 'group_id',
value: group.id value: group.id,
user: user,
namespace: group
) )
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
......
...@@ -29,7 +29,9 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do ...@@ -29,7 +29,9 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
category: 'Groups::Analytics::RepositoryAnalyticsController', category: 'Groups::Analytics::RepositoryAnalyticsController',
action: 'show', action: 'show',
label: 'group_id', label: 'group_id',
value: group.id value: group.id,
namespace: group,
user: current_user
) )
end end
......
...@@ -32,7 +32,7 @@ RSpec.shared_examples GroupInviteMembers do ...@@ -32,7 +32,7 @@ RSpec.shared_examples GroupInviteMembers do
it 'tracks the event' do it 'tracks the event' do
subject subject
expect_snowplow_event(category: anything, action: 'invite_members', label: 'new_group_form') expect_snowplow_event(category: anything, action: 'invite_members', label: 'new_group_form', user: user)
end end
end end
end end
......
...@@ -117,7 +117,7 @@ module API ...@@ -117,7 +117,7 @@ module API
not_allowed! # This currently can only be reached in EE not_allowed! # This currently can only be reached in EE
elsif member.valid? && member.persisted? elsif member.valid? && member.persisted?
present_members(member) present_members(member)
Gitlab::Tracking.event(::Members::CreateService.name, 'create_member', label: params[:invite_source], property: 'existing_user') Gitlab::Tracking.event(::Members::CreateService.name, 'create_member', label: params[:invite_source], property: 'existing_user', user: current_user)
else else
render_validation_error!(member) render_validation_error!(member)
end end
......
...@@ -162,7 +162,8 @@ RSpec.describe API::Invitations do ...@@ -162,7 +162,8 @@ RSpec.describe API::Invitations do
category: 'Members::InviteService', category: 'Members::InviteService',
action: 'create_member', action: 'create_member',
label: 'api', label: 'api',
property: 'net_new_user' property: 'net_new_user',
user: maintainer
) )
end end
...@@ -173,7 +174,8 @@ RSpec.describe API::Invitations do ...@@ -173,7 +174,8 @@ RSpec.describe API::Invitations do
category: 'Members::InviteService', category: 'Members::InviteService',
action: 'create_member', action: 'create_member',
label: '_invite_source_', label: '_invite_source_',
property: 'net_new_user' property: 'net_new_user',
user: maintainer
) )
end end
end end
......
...@@ -266,7 +266,8 @@ RSpec.describe API::Members do ...@@ -266,7 +266,8 @@ RSpec.describe API::Members do
category: 'Members::CreateService', category: 'Members::CreateService',
action: 'create_member', action: 'create_member',
label: 'api', label: 'api',
property: 'existing_user' property: 'existing_user',
user: maintainer
) )
end end
...@@ -278,7 +279,8 @@ RSpec.describe API::Members do ...@@ -278,7 +279,8 @@ RSpec.describe API::Members do
category: 'Members::CreateService', category: 'Members::CreateService',
action: 'create_member', action: 'create_member',
label: '_invite_source_', label: '_invite_source_',
property: 'existing_user' property: 'existing_user',
user: maintainer
) )
end end
end end
...@@ -321,7 +323,8 @@ RSpec.describe API::Members do ...@@ -321,7 +323,8 @@ RSpec.describe API::Members do
category: 'Members::CreateService', category: 'Members::CreateService',
action: 'create_member', action: 'create_member',
label: 'api', label: 'api',
property: 'existing_user' property: 'existing_user',
user: maintainer
) )
end end
...@@ -333,7 +336,8 @@ RSpec.describe API::Members do ...@@ -333,7 +336,8 @@ RSpec.describe API::Members do
category: 'Members::CreateService', category: 'Members::CreateService',
action: 'create_member', action: 'create_member',
label: '_invite_source_', label: '_invite_source_',
property: 'existing_user' property: 'existing_user',
user: maintainer
) )
end end
end end
......
...@@ -53,7 +53,10 @@ RSpec.describe Issues::ZoomLinkService do ...@@ -53,7 +53,10 @@ RSpec.describe Issues::ZoomLinkService do
category: 'IncidentManagement::ZoomIntegration', category: 'IncidentManagement::ZoomIntegration',
action: 'add_zoom_meeting', action: 'add_zoom_meeting',
label: 'Issue ID', label: 'Issue ID',
value: issue.id value: issue.id,
user: user,
project: project,
namespace: project.namespace
) )
end end
...@@ -192,7 +195,10 @@ RSpec.describe Issues::ZoomLinkService do ...@@ -192,7 +195,10 @@ RSpec.describe Issues::ZoomLinkService do
category: 'IncidentManagement::ZoomIntegration', category: 'IncidentManagement::ZoomIntegration',
action: 'remove_zoom_meeting', action: 'remove_zoom_meeting',
label: 'Issue ID', label: 'Issue ID',
value: issue.id value: issue.id,
user: user,
project: project,
namespace: project.namespace
) )
end end
end end
......
...@@ -93,7 +93,8 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_ ...@@ -93,7 +93,8 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_
category: described_class.name, category: described_class.name,
action: 'create_member', action: 'create_member',
label: 'unknown', label: 'unknown',
property: 'existing_user' property: 'existing_user',
user: user
) )
end end
end end
...@@ -108,7 +109,8 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_ ...@@ -108,7 +109,8 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_
category: described_class.name, category: described_class.name,
action: 'create_member', action: 'create_member',
label: '_invite_source_', label: '_invite_source_',
property: 'existing_user' property: 'existing_user',
user: user
) )
end end
end end
...@@ -123,7 +125,8 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_ ...@@ -123,7 +125,8 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_
category: described_class.name, category: described_class.name,
action: 'create_member', action: 'create_member',
label: 'unknown', label: 'unknown',
property: 'net_new_user' property: 'net_new_user',
user: user
) )
end end
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