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:
Diffstat (limited to 'lib/gitlab/usage_data_counters/editor_unique_counter.rb')
-rw-r--r--lib/gitlab/usage_data_counters/editor_unique_counter.rb28
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/gitlab/usage_data_counters/editor_unique_counter.rb b/lib/gitlab/usage_data_counters/editor_unique_counter.rb
index 8feb24e49ac..5ede840661a 100644
--- a/lib/gitlab/usage_data_counters/editor_unique_counter.rb
+++ b/lib/gitlab/usage_data_counters/editor_unique_counter.rb
@@ -10,24 +10,24 @@ module Gitlab
EDIT_BY_LIVE_PREVIEW = 'g_edit_by_live_preview'
class << self
- def track_web_ide_edit_action(author:, time: Time.zone.now)
- track_unique_action(EDIT_BY_WEB_IDE, author, time)
+ def track_web_ide_edit_action(author:, time: Time.zone.now, project:)
+ track_unique_action(EDIT_BY_WEB_IDE, author, time, project)
end
def count_web_ide_edit_actions(date_from:, date_to:)
count_unique(EDIT_BY_WEB_IDE, date_from, date_to)
end
- def track_sfe_edit_action(author:, time: Time.zone.now)
- track_unique_action(EDIT_BY_SFE, author, time)
+ def track_sfe_edit_action(author:, time: Time.zone.now, project:)
+ track_unique_action(EDIT_BY_SFE, author, time, project)
end
def count_sfe_edit_actions(date_from:, date_to:)
count_unique(EDIT_BY_SFE, date_from, date_to)
end
- def track_snippet_editor_edit_action(author:, time: Time.zone.now)
- track_unique_action(EDIT_BY_SNIPPET_EDITOR, author, time)
+ def track_snippet_editor_edit_action(author:, time: Time.zone.now, project:)
+ track_unique_action(EDIT_BY_SNIPPET_EDITOR, author, time, project)
end
def count_snippet_editor_edit_actions(date_from:, date_to:)
@@ -39,15 +39,25 @@ module Gitlab
count_unique(events, date_from, date_to)
end
- def track_live_preview_edit_action(author:, time: Time.zone.now)
- track_unique_action(EDIT_BY_LIVE_PREVIEW, author, time)
+ def track_live_preview_edit_action(author:, time: Time.zone.now, project:)
+ track_unique_action(EDIT_BY_LIVE_PREVIEW, author, time, project)
end
private
- def track_unique_action(action, author, time)
+ def track_unique_action(action, author, time, project = nil)
return unless author
+ if Feature.enabled?(:route_hll_to_snowplow_phase2)
+ Gitlab::Tracking.event(
+ 'ide_edit',
+ action.to_s,
+ project: project,
+ namespace: project&.namespace,
+ user: author
+ )
+ end
+
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(action, values: author.id, time: time)
end