Commit 0aaa3d13 authored by Rajendra Kadam's avatar Rajendra Kadam

Add user/namespace and project in tracking calls

parent 8392eb0f
...@@ -8,7 +8,7 @@ module Mutations ...@@ -8,7 +8,7 @@ module Mutations
def track_event(event, scope) def track_event(event, scope)
::Packages::CreateEventService.new(nil, current_user, event_name: event, scope: scope).execute ::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 end
end end
...@@ -89,7 +89,7 @@ module Gitlab ...@@ -89,7 +89,7 @@ module Gitlab
end end
def track_event(result) 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) success(result)
end end
......
...@@ -118,7 +118,8 @@ module Gitlab ...@@ -118,7 +118,8 @@ module Gitlab
end end
def track_event(result) 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) success(result)
end end
......
...@@ -56,10 +56,10 @@ RSpec.describe Gitlab::DatabaseImporters::InstanceAdministrators::CreateGroup do ...@@ -56,10 +56,10 @@ RSpec.describe Gitlab::DatabaseImporters::InstanceAdministrators::CreateGroup do
it "tracks successful install" do it "tracks successful install" do
expect(::Gitlab::Tracking).to receive(:event).with( expect(::Gitlab::Tracking).to receive(:event).with(
'instance_administrators_group', 'group_created' 'instance_administrators_group', 'group_created', namespace: group
) )
result subject.execute
end end
it 'creates group' do it 'creates group' do
......
...@@ -86,10 +86,10 @@ RSpec.describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService ...@@ -86,10 +86,10 @@ RSpec.describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService
end end
it "tracks successful install" do it "tracks successful install" do
expect(::Gitlab::Tracking).to receive(:event).twice 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') expect(::Gitlab::Tracking).to receive(:event).with('self_monitoring', 'project_created', project: project, namespace: project.namespace)
result subject.execute
end end
it 'creates group' do 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