Skip to content

Create module for Internal Events

Jonas Larsen requested to merge 435200-create-internal-events-module into master

What does this MR do and why?

We would like the source location of where an event was triggered to be sent in the category property in Snowplow events.

In order to make it simple to get this information we provide this module that automatically gets the self.class.name and use it as category.

The MR also change a single use of Gitlab::InternalEvents.track_event to use the new module.

With the new module you can now call Internal Events like this:

module TestModule
  class ClassThatTracks
    include Gitlab::InternalEventsTracking

    def do_it
      # Do important work here

      track_internal_event('my_event', project: Project.first, user: User.last)
    end
  end
end

Instead of like this:

module TestModule
  class ClassThatTracks
    def do_it
      # Do important work here

      Gitlab::InternalEvents.track_event('my_event', project: Project.first, user: User.last)
    end
  end
end

Documentation will be included in a follow up MR.

So will a change to danger to make sure analytics instrumentation gets tagged for review.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #435200 (closed)

Edited by Jonas Larsen

Merge request reports