Skip to content
代码片段 群组 项目
提交 1d4648cd 编辑于 作者: Niko Belokolodov's avatar Niko Belokolodov 提交者: James Fargher
浏览文件

Add service ping context for EditorUniqueCounter events

上级 605ff831
No related branches found
No related tags found
无相关合并请求
---
description: Triggered from backend on editing file in web ide
category: ide_edit
action: g_edit_by_web_ide
identifiers:
- project
- user
- namespace
product_section: dev
product_stage: create
product_group: group::editor
product_category: web_ide
milestone: "15.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate
---
description: Triggered from backend on editing file by sfe
category: ide_edit
action: g_edit_by_sfe
identifiers:
- project
- user
- namespace
product_section: dev
product_stage: create
product_group: group::editor
product_category: web_ide
milestone: "15.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate
---
description: Triggered from backend on editing file by ide snippet
category: ide_edit
action: g_edit_by_snippet_ide
identifiers:
- project
- user
- namespace
product_section: dev
product_stage: create
product_group: group::editor
product_category: web_ide
milestone: "15.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate
---
description: Triggered from backend on showing a file in live preview
category: ide_edit
action: g_edit_by_live_preview
description: Triggered from backend on interaction with web ide
category: Gitlab::UsageDataCounters::EditorUniqueCounter
action: ide_edit
identifiers:
- project
- user
......@@ -10,8 +10,8 @@ product_section: dev
product_stage: create
product_group: group::editor
product_category: web_ide
milestone: "15.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90484
milestone: "15.7"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/104809
distributions:
- ce
- ee
......@@ -19,4 +19,3 @@ tiers:
- free
- premium
- ultimate
......@@ -45,20 +45,23 @@ def track_live_preview_edit_action(author:, time: Time.zone.now, project:)
private
def track_unique_action(action, author, time, project = nil)
def track_unique_action(event_name, author, time, project = nil)
return unless author
if Feature.enabled?(:route_hll_to_snowplow_phase2)
Gitlab::Tracking.event(
name,
'ide_edit',
action.to_s,
property: event_name.to_s,
project: project,
namespace: project&.namespace,
user: author
user: author,
label: 'usage_activity_by_stage_monthly.create.action_monthly_active_users_ide_edit',
context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event_name).to_context]
)
end
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(action, values: author.id, time: time)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: author.id, time: time)
end
def count_unique(actions, date_from, date_to)
......
......@@ -91,11 +91,14 @@
expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'Snowplow event tracking' do
it_behaves_like 'Snowplow event tracking with RedisHLL context' do
let(:project) { create(:project) }
let(:category) { 'ide_edit' }
let(:action) { 'g_edit_by_live_preview' }
let(:namespace) { project.namespace }
let(:category) { 'Gitlab::UsageDataCounters::EditorUniqueCounter' }
let(:action) { 'ide_edit' }
let(:property) { 'g_edit_by_live_preview' }
let(:label) { 'usage_activity_by_stage_monthly.create.action_monthly_active_users_ide_edit' }
let(:context) { [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event_name).to_context] }
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
end
end
......
......@@ -492,10 +492,13 @@
subject
end
it_behaves_like 'Snowplow event tracking' do
let(:namespace) { project.namespace }
let(:category) { 'ide_edit' }
let(:action) { 'g_edit_by_web_ide' }
it_behaves_like 'Snowplow event tracking with RedisHLL context' do
let(:namespace) { project.namespace.reload }
let(:category) { 'Gitlab::UsageDataCounters::EditorUniqueCounter' }
let(:action) { 'ide_edit' }
let(:property) { 'g_edit_by_web_ide' }
let(:label) { 'usage_activity_by_stage_monthly.create.action_monthly_active_users_ide_edit' }
let(:context) { [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event_name).to_context] }
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
end
......
......@@ -192,11 +192,18 @@ def blob_at(filename)
stub_session('warden.user.user.key' => [[current_user.id], current_user.authenticatable_salt])
end
it_behaves_like 'Snowplow event tracking' do
it_behaves_like 'Snowplow event tracking with RedisHLL context' do
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
let(:user) { current_user }
let(:property) { 'g_edit_by_snippet_ide' }
let(:namespace) { project.namespace }
let(:category) { 'ide_edit' }
let(:action) { 'g_edit_by_snippet_ide' }
let(:category) { 'Gitlab::UsageDataCounters::EditorUniqueCounter' }
let(:action) { 'ide_edit' }
let(:label) { 'usage_activity_by_stage_monthly.create.action_monthly_active_users_ide_edit' }
let(:context) do
[Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event_name).to_context]
end
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册