Commit c36bc2ff authored by Alex Kalderimis's avatar Alex Kalderimis

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

Add user/namespace and project in tracking calls

See merge request gitlab-org/gitlab!64493
parents 121420a9 0aaa3d13
......@@ -8,7 +8,7 @@ module Mutations
def track_event(event, scope)
::Packages::CreateEventService.new(nil, current_user, event_name: event, scope: scope).execute
::Gitlab::Tracking.event(event.to_s, scope.to_s)
::Gitlab::Tracking.event(event.to_s, scope.to_s, user: current_user)
end
end
end
......@@ -89,7 +89,7 @@ module Gitlab
end
def track_event(result)
::Gitlab::Tracking.event("instance_administrators_group", "group_created")
::Gitlab::Tracking.event("instance_administrators_group", "group_created", namespace: result[:group])
success(result)
end
......
......@@ -118,7 +118,8 @@ module Gitlab
end
def track_event(result)
::Gitlab::Tracking.event("self_monitoring", "project_created")
project = result[:project]
::Gitlab::Tracking.event("self_monitoring", "project_created", project: project, namespace: project.namespace)
success(result)
end
......
......@@ -56,10 +56,10 @@ RSpec.describe Gitlab::DatabaseImporters::InstanceAdministrators::CreateGroup do
it "tracks successful install" do
expect(::Gitlab::Tracking).to receive(:event).with(
'instance_administrators_group', 'group_created'
'instance_administrators_group', 'group_created', namespace: group
)
result
subject.execute
end
it 'creates group' do
......
......@@ -86,10 +86,10 @@ RSpec.describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService
end
it "tracks successful install" do
expect(::Gitlab::Tracking).to receive(:event).twice
expect(::Gitlab::Tracking).to receive(:event).with('self_monitoring', 'project_created')
expect(::Gitlab::Tracking).to receive(:event).with("instance_administrators_group", "group_created", namespace: project.namespace)
expect(::Gitlab::Tracking).to receive(:event).with('self_monitoring', 'project_created', project: project, namespace: project.namespace)
result
subject.execute
end
it 'creates group' do
......
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