Skip to content

Create command line monitor for internal events tracking

Jonas Larsen requested to merge j_lar/internal-event-monitor into master

What does this MR do and why?

Adds a script that makes it way easier to monitor which metrics are updated and which Snowplow events are triggered.

Currently it takes a lot of work and looking around in the Service Ping payload to verify that metrics got updated. This script removes that pain point in many cases.

Video demo:

command_line_monitor_short

This script does not have any test and the code show very clearly that this is a proof of concept.

In the spirit of iterating and providing value as early as possible, I suggest that we merge it now and address the test and code structure another issue: #426630

How to set up and validate locally

  1. Open two terminals
  2. Start the monitor in Terminal 1 by running bin/rails runner scripts/internal_events/monitor.rb i_code_review_saved_replies_use i_code_review_saved_replies_create
  3. Start a Rails console in Terminal 2 by running gdk rails console
  4. Trigger an event in 2 by executing: Gitlab::InternalEvents.track_event("i_code_review_saved_replies_create", user: User.last, namespace: Namespace.last)
  5. Verify in Terminal 2 that:
    1. The metrics defined on i_code_review_saved_replies_create increased (If you didn't already trigger an event with this user previously)
    2. A new Snowplow event appeared on the list with the correct event_name, user_id and namespace_id

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 Jonas Larsen

Merge request reports