Enforcing prometheus labels for the SLI metrics
What does this MR do and why?
Missing request_urgency
for the gitlab_sli_rails_request_error_total metric broke staging when feature flag gitlab_metrics_error_rate_sli
was enabled.
{"timestamp":"2022-12-01T14:44:18.716Z","pid":1,"message":"! Unable to load application: Prometheus::Client::LabelSetValidator::InvalidLabelSetError: labels must have the same signature: (expected keys: [:endpoint_id, :feature_category, :request_urgency], got: [:endpoint_id, :feature_category])"}
/srv/gitlab/vendor/bundle/ruby/2.7.0/gems/prometheus-client-mmap-0.16.2/lib/prometheus/client/label_set_validator.rb:40:in `validate': labels must have the same signature: (expected keys: [:endpoint_id, :feature_category, :request_urgency], got: [:endpoint_id, :feature_category]) (Prometheus::Client::LabelSetValidator::InvalidLabelSetError)
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/prometheus-client-mmap-0.16.2/lib/prometheus/client/metric.rb:72:in `label_set_for'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/prometheus-client-mmap-0.16.2/lib/prometheus/client/counter.rb:16:in `increment'
from /srv/gitlab/lib/gitlab/metrics/sli.rb:57:in `increment'
from /srv/gitlab/lib/gitlab/metrics/sli.rb:97:in `increment'
from /srv/gitlab/lib/gitlab/metrics/requests_rack_middleware.rb:131:in `record_error'
from /srv/gitlab/lib/gitlab/metrics/requests_rack_middleware.rb:86:in `call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/gitlab-labkit-0.29.0/lib/labkit/middleware/rack.rb:19:in `block in call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/gitlab-labkit-0.29.0/lib/labkit/context.rb:36:in `with_context'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/gitlab-labkit-0.29.0/lib/labkit/middleware/rack.rb:18:in `call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/sentry-raven-3.1.2/lib/raven/integrations/rack.rb:51:in `call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/engine.rb:539:in `call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
from /srv/gitlab/lib/gitlab/middleware/release_env.rb:13:in `call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `each'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `call'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/mock.rb:84:in `request'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/mock.rb:57:in `get'
from /srv/gitlab/config.ru:9:in `block (2 levels) in <main>'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/builder.rb:236:in `to_app'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/builder.rb:117:in `new_from_string'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/builder.rb:105:in `load_file'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-2.2.4/lib/rack/builder.rb:66:in `parse_file'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/puma-5.6.5/lib/puma/configuration.rb:348:in `load_rackup'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/puma-5.6.5/lib/puma/configuration.rb:270:in `app'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/puma-5.6.5/lib/puma/runner.rb:150:in `load_and_bind'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/puma-5.6.5/lib/puma/cluster.rb:357:in `run'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/puma-5.6.5/lib/puma/launcher.rb:193:in `run'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/puma-5.6.5/lib/puma/cli.rb:81:in `run'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/gems/puma-5.6.5/bin/puma:10:in `<top (required)>'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/bin/puma:25:in `load'
from /srv/gitlab/vendor/bundle/ruby/2.7.0/bin/puma:25:in `<top (required)>'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `load'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:23:in `run'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli.rb:483:in `exec'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli.rb:31:in `dispatch'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli.rb:25:in `start'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/exe/bundle:48:in `block in <top (required)>'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /usr/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/exe/bundle:36:in `<top (required)>'
from /srv/gitlab/bin/bundle:5:in `load'
from /srv/gitlab/bin/bundle:5:in `<main>'
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Hercules Merscher