diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /lib/gitlab/usage_data_counters | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'lib/gitlab/usage_data_counters')
6 files changed, 23 insertions, 8 deletions
diff --git a/lib/gitlab/usage_data_counters/diffs_counter.rb b/lib/gitlab/usage_data_counters/diffs_counter.rb new file mode 100644 index 00000000000..b06c7e26f54 --- /dev/null +++ b/lib/gitlab/usage_data_counters/diffs_counter.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Gitlab + module UsageDataCounters + class DiffsCounter < BaseCounter + KNOWN_EVENTS = %w[searches].freeze + PREFIX = 'diff' + end + end +end diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb index 597df9936ea..96562a44391 100644 --- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb +++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb @@ -117,7 +117,7 @@ module Gitlab private def track(values, event_name, context: '', time: Time.zone.now) - return unless usage_ping_enabled? + return unless ::ServicePing::ServicePingSettings.enabled? event = event_for(event_name) Gitlab::ErrorTracking.track_and_raise_for_dev_exception(UnknownEvent.new("Unknown event #{event_name}")) unless event.present? @@ -131,10 +131,6 @@ module Gitlab Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e) end - def usage_ping_enabled? - Gitlab::CurrentSettings.usage_ping_enabled? - end - # The array of valid context on which we allow tracking def valid_context_list Plan.all_plans @@ -193,6 +189,7 @@ module Gitlab def events_in_same_slot?(events) # if we check one event then redis_slot is only one to check + return false if events.empty? return true if events.size == 1 slot = events.first[:redis_slot] diff --git a/lib/gitlab/usage_data_counters/known_events/code_review_events.yml b/lib/gitlab/usage_data_counters/known_events/code_review_events.yml index 5023161a9dd..7ad51bfe832 100644 --- a/lib/gitlab/usage_data_counters/known_events/code_review_events.yml +++ b/lib/gitlab/usage_data_counters/known_events/code_review_events.yml @@ -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 diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml index fe1eb090fa4..3db0482d38e 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -170,7 +170,6 @@ category: testing redis_slot: testing aggregation: weekly - feature_flag: usage_data_i_testing_full_code_quality_report_total - name: i_testing_web_performance_widget_total category: testing redis_slot: testing diff --git a/lib/gitlab/usage_data_counters/known_events/quickactions.yml b/lib/gitlab/usage_data_counters/known_events/quickactions.yml index c1eabb352f7..7df351859fb 100644 --- a/lib/gitlab/usage_data_counters/known_events/quickactions.yml +++ b/lib/gitlab/usage_data_counters/known_events/quickactions.yml @@ -179,6 +179,10 @@ category: quickactions redis_slot: quickactions aggregation: weekly +- name: i_quickactions_severity + category: quickactions + redis_slot: quickactions + aggregation: weekly - name: i_quickactions_shrug category: quickactions redis_slot: quickactions diff --git a/lib/gitlab/usage_data_counters/redis_counter.rb b/lib/gitlab/usage_data_counters/redis_counter.rb index 2406f771fd8..591e431c871 100644 --- a/lib/gitlab/usage_data_counters/redis_counter.rb +++ b/lib/gitlab/usage_data_counters/redis_counter.rb @@ -4,13 +4,13 @@ module Gitlab module UsageDataCounters module RedisCounter def increment(redis_counter_key) - return unless Gitlab::CurrentSettings.usage_ping_enabled + return unless ::ServicePing::ServicePingSettings.enabled? Gitlab::Redis::SharedState.with { |redis| redis.incr(redis_counter_key) } end def increment_by(redis_counter_key, incr) - return unless Gitlab::CurrentSettings.usage_ping_enabled + return unless ::ServicePing::ServicePingSettings.enabled? Gitlab::Redis::SharedState.with { |redis| redis.incrby(redis_counter_key, incr) } end |