Commit f67ec92e authored by fjsanpedro's avatar fjsanpedro Committed by Francisco Javier López

Add MAU counter for snippet show action

In this commit we add the logic to track the snippets
show action
parent 8757820e
......@@ -9,11 +9,14 @@ module SnippetsActions
include Gitlab::NoteableMetadata
include Snippets::SendBlob
include SnippetsSort
include RedisTracking
included do
skip_before_action :verify_authenticity_token,
if: -> { action_name == 'show' && js_request? }
track_redis_hll_event :show, name: 'i_snippets_show', feature: :usage_data_i_snippets_show, feature_default_enabled: false
respond_to :html
end
......
---
name: usage_data_i_snippets_show
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48113
rollout_issue_url:
milestone: '13.7'
type: development
group: group::editor
default_enabled: false
......@@ -408,3 +408,8 @@
redis_slot: ci_secrets_management
aggregation: weekly
feature_flag: usage_data_i_ci_secrets_management_vault_build_created
- name: i_snippets_show
category: snippets
redis_slot: snippets
aggregation: weekly
feature_flag: usage_data_i_snippets_show
......@@ -172,6 +172,13 @@ RSpec.describe SnippetsController do
expect(assigns(:snippet)).to eq(public_snippet)
expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'tracking unique hll events', :usage_data_i_snippets_show do
subject(:request) { get :show, params: { id: public_snippet.to_param } }
let(:target_id) { 'i_snippets_show' }
let(:expected_type) { instance_of(String) }
end
end
context 'when not signed in' do
......
......@@ -44,7 +44,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
'golang_packages',
'debian_packages',
'container_packages',
'tag_packages'
'tag_packages',
'snippets'
)
end
end
......
......@@ -1235,7 +1235,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
subject { described_class.redis_hll_counters }
let(:categories) { ::Gitlab::UsageDataCounters::HLLRedisCounter.categories }
let(:ineligible_total_categories) { %w[source_code testing ci_secrets_management incident_management_alerts] }
let(:ineligible_total_categories) { %w[source_code testing ci_secrets_management incident_management_alerts snippets] }
it 'has all known_events' do
expect(subject).to have_key(:redis_hll_counters)
......
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