diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /lib/gitlab/metrics | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'lib/gitlab/metrics')
-rw-r--r-- | lib/gitlab/metrics/dashboard/stages/alerts_inserter.rb | 41 | ||||
-rw-r--r-- | lib/gitlab/metrics/samplers/database_sampler.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/metrics/sli.rb | 12 |
3 files changed, 9 insertions, 46 deletions
diff --git a/lib/gitlab/metrics/dashboard/stages/alerts_inserter.rb b/lib/gitlab/metrics/dashboard/stages/alerts_inserter.rb deleted file mode 100644 index 38736158c3b..00000000000 --- a/lib/gitlab/metrics/dashboard/stages/alerts_inserter.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require 'set' - -module Gitlab - module Metrics - module Dashboard - module Stages - class AlertsInserter < BaseStage - include ::Gitlab::Utils::StrongMemoize - - def transform! - return if metrics_with_alerts.empty? - - for_metrics do |metric| - next unless metrics_with_alerts.include?(metric[:metric_id]) - - metric[:alert_path] = alert_path(metric[:metric_id], project, params[:environment]) - end - end - - private - - def metrics_with_alerts - strong_memoize(:metrics_with_alerts) do - alerts = ::Projects::Prometheus::AlertsFinder - .new(project: project, environment: params[:environment]) - .execute - - Set.new(alerts.map(&:prometheus_metric_id)) - end - end - - def alert_path(metric_id, project, environment) - ::Gitlab::Routing.url_helpers.project_prometheus_alert_path(project, metric_id, environment_id: environment.id, format: :json) - end - end - end - end - end -end diff --git a/lib/gitlab/metrics/samplers/database_sampler.rb b/lib/gitlab/metrics/samplers/database_sampler.rb index 965d85e20e5..86372973c82 100644 --- a/lib/gitlab/metrics/samplers/database_sampler.rb +++ b/lib/gitlab/metrics/samplers/database_sampler.rb @@ -72,7 +72,7 @@ module Gitlab { host: host.host, port: host.port, - class: load_balancer.configuration.primary_connection_specification_name, + class: load_balancer.configuration.connection_specification_name, db_config_name: Gitlab::Database.db_config_name(host.connection) } end diff --git a/lib/gitlab/metrics/sli.rb b/lib/gitlab/metrics/sli.rb index fcd893b675f..2de19514354 100644 --- a/lib/gitlab/metrics/sli.rb +++ b/lib/gitlab/metrics/sli.rb @@ -68,10 +68,6 @@ module Gitlab prometheus.counter(counter_name('total'), "Total number of measurements for #{name}") end - def counter_name(suffix) - :"#{COUNTER_PREFIX}:#{name}_#{self.class.name.demodulize.underscore}:#{suffix}" - end - def prometheus Gitlab::Metrics end @@ -85,6 +81,10 @@ module Gitlab private + def counter_name(suffix) + :"#{COUNTER_PREFIX}:#{name}_apdex:#{suffix}" + end + def numerator_counter prometheus.counter(counter_name('success_total'), "Number of successful measurements for #{name}") end @@ -99,6 +99,10 @@ module Gitlab private + def counter_name(suffix) + :"#{COUNTER_PREFIX}:#{name}:#{suffix}" + end + def numerator_counter prometheus.counter(counter_name('error_total'), "Number of error measurements for #{name}") end |