diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-20 17:55:47 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-20 17:55:47 +0300 |
commit | 9e9039cef215d36a2d71838414f98a4a64b8c9b2 (patch) | |
tree | 6009b483189f1297cb510d726c9df5e5430560a3 /lib | |
parent | 7e83993ded8eb7b4b8d37d2823e1c555dd7e16a2 (diff) | |
parent | 50c9ba43f80e1da16532162984c2ebcecdcbbd48 (diff) |
Merge branch '43424-put_all_event_metrics_behind_feature_flags' into 'master'
Fix for sidekiq metrics set cardinality growing unbounded
Closes #43424
See merge request gitlab-org/gitlab-ce!17235
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/metrics/transaction.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/gitlab/metrics/transaction.rb b/lib/gitlab/metrics/transaction.rb index 45b9e14ba55..f3e48083c19 100644 --- a/lib/gitlab/metrics/transaction.rb +++ b/lib/gitlab/metrics/transaction.rb @@ -73,7 +73,7 @@ module Gitlab # event_name - The name of the event (e.g. "git_push"). # tags - A set of tags to attach to the event. def add_event(event_name, tags = {}) - self.class.transaction_metric(event_name, :counter, prefix: 'event_', tags: tags).increment(tags.merge(labels)) + self.class.transaction_metric(event_name, :counter, prefix: 'event_', use_feature_flag: true, tags: tags).increment(tags.merge(labels)) @metrics << Metric.new(EVENT_SERIES, { count: 1 }, tags.merge(event: event_name), :event) end @@ -150,11 +150,12 @@ module Gitlab with_feature :prometheus_metrics_transaction_allocated_memory end - def self.transaction_metric(name, type, prefix: nil, tags: {}) + def self.transaction_metric(name, type, prefix: nil, use_feature_flag: false, tags: {}) metric_name = "gitlab_transaction_#{prefix}#{name}_total".to_sym fetch_metric(type, metric_name) do docstring "Transaction #{prefix}#{name} #{type}" base_labels tags.merge(BASE_LABELS) + with_feature "prometheus_transaction_#{prefix}#{name}_total".to_sym if use_feature_flag if type == :gauge multiprocess_mode :livesum |