Commit 5ccf6e7f authored by Luis Mejia's avatar Luis Mejia

Remove ci_templates_total_unique metrics

Add CATEGORIES_FOR_TOTALS for explicit validation

Changelog: removed
parent f596700d
...@@ -7,7 +7,8 @@ product_stage: configure ...@@ -7,7 +7,8 @@ product_stage: configure
product_group: group::configure product_group: group::configure
product_category: infrastructure_as_code product_category: infrastructure_as_code
value_type: number value_type: number
status: broken status: removed
milestone_removed: '14.3'
repair_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/332466 repair_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/332466
time_frame: 28d time_frame: 28d
data_source: redis_hll data_source: redis_hll
......
...@@ -7,7 +7,8 @@ product_stage: configure ...@@ -7,7 +7,8 @@ product_stage: configure
product_group: group::configure product_group: group::configure
product_category: infrastructure_as_code product_category: infrastructure_as_code
value_type: number value_type: number
status: broken status: removed
milestone_removed: '14.3'
repair_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/332466 repair_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/332466
time_frame: 7d time_frame: 7d
data_source: redis_hll data_source: redis_hll
......
...@@ -18,6 +18,24 @@ module Gitlab ...@@ -18,6 +18,24 @@ module Gitlab
KNOWN_EVENTS_PATH = File.expand_path('known_events/*.yml', __dir__) KNOWN_EVENTS_PATH = File.expand_path('known_events/*.yml', __dir__)
ALLOWED_AGGREGATIONS = %i(daily weekly).freeze ALLOWED_AGGREGATIONS = %i(daily weekly).freeze
CATEGORIES_FOR_TOTALS = %w[
analytics
code_review
compliance
deploy_token_packages
ecosystem
epic_boards_usage
epics_usage
ide_edit
incident_management
issues_edit
pipeline_authoring
quickactions
search
testing
user_packages
].freeze
# Track event on entity_id # Track event on entity_id
# Increment a Redis HLL counter for unique event_name and entity_id # Increment a Redis HLL counter for unique event_name and entity_id
# #
...@@ -90,7 +108,7 @@ module Gitlab ...@@ -90,7 +108,7 @@ module Gitlab
hash["#{event}_monthly"] = unique_events(**monthly_time_range.merge(event_names: [event])) hash["#{event}_monthly"] = unique_events(**monthly_time_range.merge(event_names: [event]))
end end
if eligible_for_totals?(events_names) if eligible_for_totals?(events_names) && CATEGORIES_FOR_TOTALS.include?(category)
event_results["#{category}_total_unique_counts_weekly"] = unique_events(**weekly_time_range.merge(event_names: events_names)) event_results["#{category}_total_unique_counts_weekly"] = unique_events(**weekly_time_range.merge(event_names: events_names))
event_results["#{category}_total_unique_counts_monthly"] = unique_events(**monthly_time_range.merge(event_names: events_names)) event_results["#{category}_total_unique_counts_monthly"] = unique_events(**monthly_time_range.merge(event_names: events_names))
end end
......
...@@ -462,6 +462,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s ...@@ -462,6 +462,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
allow(described_class).to receive(:known_events).and_return(known_events) allow(described_class).to receive(:known_events).and_return(known_events)
allow(described_class).to receive(:categories).and_return(%w(category1 category2)) allow(described_class).to receive(:categories).and_return(%w(category1 category2))
stub_const('Gitlab::UsageDataCounters::HLLRedisCounter::CATEGORIES_FOR_TOTALS', %w(category1 category2))
described_class.track_event('event1_slot', values: entity1, time: 2.days.ago) described_class.track_event('event1_slot', values: entity1, time: 2.days.ago)
described_class.track_event('event2_slot', values: entity2, time: 2.days.ago) described_class.track_event('event2_slot', values: entity2, time: 2.days.ago)
described_class.track_event('event2_slot', values: entity3, time: 2.weeks.ago) described_class.track_event('event2_slot', values: entity3, time: 2.weeks.ago)
......
...@@ -1279,9 +1279,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -1279,9 +1279,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
subject { described_class.redis_hll_counters } subject { described_class.redis_hll_counters }
let(:categories) { ::Gitlab::UsageDataCounters::HLLRedisCounter.categories } let(:categories) { ::Gitlab::UsageDataCounters::HLLRedisCounter.categories }
let(:ineligible_total_categories) do
%w[source_code ci_secrets_management incident_management_alerts snippets terraform incident_management_oncall secure network_policies]
end
context 'with redis_hll_tracking feature enabled' do context 'with redis_hll_tracking feature enabled' do
it 'has all known_events' do it 'has all known_events' do
...@@ -1296,7 +1293,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -1296,7 +1293,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
metrics = keys.map { |key| "#{key}_weekly" } + keys.map { |key| "#{key}_monthly" } metrics = keys.map { |key| "#{key}_weekly" } + keys.map { |key| "#{key}_monthly" }
if ineligible_total_categories.exclude?(category) if ::Gitlab::UsageDataCounters::HLLRedisCounter::CATEGORIES_FOR_TOTALS.include?(category)
metrics.append("#{category}_total_unique_counts_weekly", "#{category}_total_unique_counts_monthly") metrics.append("#{category}_total_unique_counts_weekly", "#{category}_total_unique_counts_monthly")
end end
......
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