Skip to content

Add production database events endpoint address

What does this MR do and why?

It solves last part of #390805 (closed) and adds correct endpoint for database event tracking

Screenshots or screen recordings

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

How to set up and validate locally

First you need to emulate GitLab#com? behaviour, the most straight forward approach if to comment out guard clause

diff --git a/lib/gitlab/tracking/destinations/database_events_snowplow.rb b/lib/gitlab/tracking/destinations/database_events_snowplow.rb
index e3512bc4916b..abef6397c47c 100644
--- a/lib/gitlab/tracking/destinations/database_events_snowplow.rb
+++ b/lib/gitlab/tracking/destinations/database_events_snowplow.rb
@@ -16,7 +16,7 @@ def enabled?

         override :hostname
         def hostname
-          return HOSTNAME if ::Gitlab.com?
+          return HOSTNAME # if ::Gitlab.com?

           'localhost:9091'
         end

Then in the rails console

  1. Make sure feature flag is turned on
Feature.enabled?(:product_intelligence_database_event_tracking)
  1. Check is there any record in Analytics::CycleAnalytics::Stage relation, if not create one
if Analytics::CycleAnalytics::Stage.count < 1
  FactoryBot.create(:cycle_analytics_stage)
end 
  1. Check counter of total database events and good database events
Gitlab::Metrics.counter(
            :gitlab_db_events_snowplow_events_total,
            'Number of Snowplow events'
          ).get
Gitlab::Metrics.counter(
            :gitlab_db_events_snowplow_successful_events_total,
            'Number of successful Snowplow events emissions'
          ).get
  1. Trigger some database events
10.times { Analytics::CycleAnalytics::Stage.first.touch }
  1. Check state of the counters again
Gitlab::Metrics.counter(
            :gitlab_db_events_snowplow_events_total,
            'Number of Snowplow events'
          ).get
Gitlab::Metrics.counter(
            :gitlab_db_events_snowplow_successful_events_total,
            'Number of successful Snowplow events emissions'
          ).get

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 Mikołaj Wawrzyniak

Merge request reports