Commit a23fe298 authored by Phil Hughes's avatar Phil Hughes Committed by Kushal Pandya

Instrument usage of browser find in diffs

parent 23852b6c
......@@ -506,7 +506,10 @@ export default {
);
}
if (window.gon?.features?.diffsVirtualScrolling) {
if (
window.gon?.features?.diffsVirtualScrolling ||
window.gon?.features?.diffSearchingUsageData
) {
let keydownTime;
Mousetrap.bind(['mod+f', 'mod+g'], () => {
keydownTime = new Date().getTime();
......@@ -520,6 +523,11 @@ export default {
// and max 1000ms to be sure it the search box is filtered
if (delta >= 0 && delta < 1000) {
this.disableVirtualScroller = true;
if (window.gon?.features?.diffSearchingUsageData) {
api.trackRedisHllUserEvent('i_code_review_user_searches_diff');
api.trackRedisCounterEvent('user_searches_diffs');
}
}
}
});
......
......@@ -44,6 +44,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
# Usage data feature flags
push_frontend_feature_flag(:users_expanding_widgets_usage_data, @project, default_enabled: :yaml)
push_frontend_feature_flag(:diff_settings_usage_data, default_enabled: :yaml)
push_frontend_feature_flag(:diff_searching_usage_data, @project, default_enabled: :yaml)
experiment(:invite_members_in_comment, namespace: @project.root_ancestor) do |experiment_instance|
experiment_instance.exclude! unless helpers.can_import_members?
......
---
name: diff_searching_usage_data
introduced_by_url:
rollout_issue_url:
milestone: '14.2'
type: development
group: group::code review
default_enabled: true
......@@ -65,6 +65,7 @@
- 'i_code_review_diff_multiple_files'
- 'i_code_review_user_load_conflict_ui'
- 'i_code_review_user_resolve_conflict'
- 'i_code_review_user_searches_diff'
- name: code_review_category_monthly_active_users
operator: OR
source: redis
......@@ -122,6 +123,7 @@
- 'i_code_review_diff_multiple_files'
- 'i_code_review_user_load_conflict_ui'
- 'i_code_review_user_resolve_conflict'
- 'i_code_review_user_searches_diff'
- name: code_review_extension_category_monthly_active_users
operator: OR
source: redis
......
---
key_path: redis_hll_counters.code_review.i_code_review_user_searches_diff_monthly
description: Count of users who search merge request diffs
product_section: dev
product_stage: create
product_group: group::code review
product_category: code_review
value_type: number
status: implemented
milestone: '14.2'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66522
time_frame: 28d
data_source: redis_hll
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
key_path: redis_hll_counters.code_review.i_code_review_user_searches_diff_weekly
description: Count of users who search merge request diffs
product_section: dev
product_stage: create
product_group: group::code review
product_category: code_review
value_type: number
status: implemented
milestone: '14.2'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66522
time_frame: 7d
data_source: redis_hll
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
key_path: counts.diff_searches
description: Total count of merge request diff searches
product_section: dev
product_stage: create
product_group: group::code review
product_category: code_review
value_type: number
status: implemented
milestone: '14.2'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66522
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
......@@ -7650,6 +7650,20 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `counts.user_searches_diffs`
Count of users who search merge request diffs
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210723075525_user_searches_diffs.yml)
Group: `group::code review`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.web_hooks`
Missing description
......@@ -10646,6 +10660,20 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `redis_hll_counters.code_review.i_code_review_searches_in_diff_monthly`
Count of searches in merge request diffs
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210722132444_i_code_review_searches_in_diff_monthly.yml)
Group: `group::code review`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `redis_hll_counters.code_review.i_code_review_user_add_suggestion_monthly`
Count of unique users per month who added a suggestion
......@@ -11514,6 +11542,20 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `redis_hll_counters.code_review.i_code_review_user_searches_diff_monthly`
Count of users who search merge request diffs
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210720144005_i_code_review_user_searches_diff_monthly.yml)
Group: `group::code review`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `redis_hll_counters.code_review.i_code_review_user_single_file_diffs_monthly`
Count of unique users per month with diffs viewed file by file
......
......@@ -15,7 +15,8 @@ module Gitlab
MergeRequestCounter,
DesignsCounter,
KubernetesAgentCounter,
StaticSiteEditorCounter
StaticSiteEditorCounter,
DiffsCounter
].freeze
UsageDataCounterError = Class.new(StandardError)
......
# frozen_string_literal: true
module Gitlab
module UsageDataCounters
class DiffsCounter < BaseCounter
KNOWN_EVENTS = %w[searches].freeze
PREFIX = 'diff'
end
end
end
......@@ -232,3 +232,8 @@
redis_slot: code_review
category: code_review
aggregation: weekly
- name: i_code_review_user_searches_diff
redis_slot: code_review
category: code_review
aggregation: weekly
feature_flag: diff_searching_usage_data
Markdown is supported
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