Use namespace from project if none provided to track_event
What does this MR do and why?
We would like to make it easier to send as much of the standard context (user, project, namespace) as possible when using Gitlab::InternalEvents.track_event
.
In most cases the project
belongs to the namespace
.
This MR adds the convenience that you can now call
Gitlab::InternalEvents.track_event('my_event', user: user, project: project)
instead of
Gitlab::InternalEvents.track_event('my_event', user: user, project: project, namespace: project.namespace)
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Start the monitor by running
rails runner scripts/internal_events/monitor.rb ci_template_included
- In another terminal run
gdk rails console
and trigger an event withGitlab::InternalEvents.track_event('ci_template_included', project: Project.first, user: User.first)
- In the monitor, verify that the new Snowplow event has namespace filled out.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jonas Larsen