Skip to content
Snippets Groups Projects
Commit 96b3c335 authored by Peter Leitzen's avatar Peter Leitzen
Browse files

Merge branch '356596' into 'master'

Track monthly active users for Live Preview

See merge request gitlab-org/gitlab!85420
parents 58769b58 7535c1a5
No related merge requests found
......@@ -17,6 +17,7 @@ def web_ide_clientside_preview_success
return render_404 unless Gitlab::CurrentSettings.web_ide_clientside_preview_enabled?
Gitlab::UsageDataCounters::WebIdeCounter.increment_previews_success_count
Gitlab::UsageDataCounters::EditorUniqueCounter.track_live_preview_edit_action(author: current_user)
head(200)
end
......
---
data_category: optional
key_path: usage_activity_by_stage_monthly.create.action_monthly_active_users_live_preview_edit
description: Count of monthly unique users that successfully connect to Live Preview
product_section: dev
product_stage: create
product_group: group::editor
product_category: web_ide
value_type: number
status: active
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85420
time_frame: 28d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- g_edit_by_live_preview
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
performance_indicator_type: []
milestone: "15.0"
......@@ -8,6 +8,7 @@ module EditorUniqueCounter
EDIT_BY_WEB_IDE = 'g_edit_by_web_ide'
EDIT_BY_SSE = 'g_edit_by_sse'
EDIT_CATEGORY = 'ide_edit'
EDIT_BY_LIVE_PREVIEW = 'g_edit_by_live_preview'
class << self
def track_web_ide_edit_action(author:, time: Time.zone.now)
......@@ -47,6 +48,10 @@ def count_sse_edit_actions(date_from:, date_to:)
count_unique(EDIT_BY_SSE, 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)
end
private
def track_unique_action(action, author, time)
......
......@@ -40,6 +40,11 @@
redis_slot: edit
expiry: 29
aggregation: daily
- name: g_edit_by_live_preview
category: ide_edit
redis_slot: edit
expiry: 29
aggregation: daily
- name: i_search_total
category: search
redis_slot: search
......
......@@ -79,6 +79,18 @@
it_behaves_like 'counter is not increased'
it_behaves_like 'counter is increased', 'WEB_IDE_PREVIEWS_SUCCESS_COUNT'
context 'when the user has access to the project' do
let(:user) { project.owner }
it 'increases the live preview view counter' do
expect(Gitlab::UsageDataCounters::EditorUniqueCounter).to receive(:track_live_preview_edit_action).with(author: user)
subject
expect(response).to have_gitlab_http_status(:ok)
end
end
end
context 'when web ide clientside preview is not enabled' do
......
......@@ -80,10 +80,13 @@ def count_unique(params)
it 'can return the count of actions per user deduplicated' do
described_class.track_web_ide_edit_action(author: user1)
described_class.track_live_preview_edit_action(author: user1)
described_class.track_snippet_editor_edit_action(author: user1)
described_class.track_sfe_edit_action(author: user1)
described_class.track_web_ide_edit_action(author: user2, time: time - 2.days)
described_class.track_web_ide_edit_action(author: user3, time: time - 3.days)
described_class.track_live_preview_edit_action(author: user2, time: time - 2.days)
described_class.track_live_preview_edit_action(author: user3, time: time - 3.days)
described_class.track_snippet_editor_edit_action(author: user3, time: time - 3.days)
described_class.track_sfe_edit_action(author: user3, time: time - 3.days)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment