Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-05 15:13:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-05 15:13:17 +0300
commitcd17aa65132de074aab9ae50ab7bbf7f16428546 (patch)
tree5a195a869320321aa9c3891e7ba5bbc9b9fc5d87 /lib/gitlab/tracking
parent508f0c4ee719abb1294684eea4a63aa44cd23597 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/tracking')
-rw-r--r--lib/gitlab/tracking/destinations/database_events_snowplow.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/gitlab/tracking/destinations/database_events_snowplow.rb b/lib/gitlab/tracking/destinations/database_events_snowplow.rb
new file mode 100644
index 00000000000..4f9cd2167f7
--- /dev/null
+++ b/lib/gitlab/tracking/destinations/database_events_snowplow.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Tracking
+ module Destinations
+ class DatabaseEventsSnowplow < Snowplow
+ extend ::Gitlab::Utils::Override
+
+ HOSTNAME = 'localhost:9091'
+
+ override :enabled?
+ # database events are only collected for SaaS instance
+ def enabled?
+ ::Gitlab.dev_or_test_env? || ::Gitlab.com?
+ end
+
+ override :hostname
+ def hostname
+ HOSTNAME
+ end
+
+ private
+
+ override :increment_failed_events_emissions
+ def increment_failed_events_emissions(value)
+ Gitlab::Metrics.counter(
+ :gitlab_db_events_snowplow_failed_events_total,
+ 'Number of failed Snowplow events emissions'
+ ).increment({}, value.to_i)
+ end
+
+ override :increment_successful_events_emissions
+ def increment_successful_events_emissions(value)
+ Gitlab::Metrics.counter(
+ :gitlab_db_events_snowplow_successful_events_total,
+ 'Number of successful Snowplow events emissions'
+ ).increment({}, value.to_i)
+ end
+
+ override :increment_total_events_counter
+ def increment_total_events_counter
+ Gitlab::Metrics.counter(
+ :gitlab_db_events_snowplow_events_total,
+ 'Number of Snowplow events'
+ ).increment
+ end
+ end
+ end
+ end
+end