Skip to content

BE - Dispatch Snowplow events from their event definitions

What does this MR do and why?

Related to #356620 (closed) and part of &7759 (closed). To be able to link an event with its definition (more wins).

Adds a .definition method to Gitlab::Tracking, with the following signature:

def definition(filename, category: nil, action: nil, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil, **extra)

This new method doesn't change any feature and it's part of the first iteration for this proposal.

How to set up and validate locally

  1. Follow the instructions in our docs to enable Snowplow Micro, if you haven't done so.
  2. Fire events via definitions from the rails console pointing to Snowplow Micro:
    SNOWPLOW_MICRO_ENABLE=1 SNOWPLOW_MICRO_URI=http://localhost:9091 bundle exec rails c
    # Examples
    Gitlab::Tracking.definition('ee_202108302307_api__releases_create_release')
    Gitlab::Tracking.definition('202108302307_security__ci_configuration__sast_create_service_create')
  3. The events should be listed in Snowplow Micro.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Axel García

Merge request reports