Class: Gitlab::AlertManagement::Payload::Prometheus
- Extended by:
- Utils::Override
- Defined in:
- lib/gitlab/alert_management/payload/prometheus.rb
Overview
Attribute mapping for alerts via prometheus alerting integration.
Constant Summary collapse
- METRIC_TIME_WINDOW =
30.minutes
- ADDITIONAL_SEVERITY_MAPPING =
{ 's1' => :critical, 's2' => :high, 's3' => :medium, 's4' => :low, 's5' => :info, 'p1' => :critical, 'p2' => :high, 'p3' => :medium, 'p4' => :low, 'p5' => :info, 'debug' => :info, 'information' => :info, 'notice' => :info, 'warn' => :low, 'warning' => :low, 'minor' => :low, 'error' => :medium, 'major' => :high, 'emergency' => :critical, 'fatal' => :critical, 'alert' => :medium, 'page' => :high }.freeze
Constants inherited from Base
Base::SEVERITY_MAPPING, Base::UNMAPPED_SEVERITY
Instance Attribute Summary
Attributes inherited from Base
#integration, #payload, #project
Instance Method Summary collapse
-
#full_query ⇒ Object
Parses ‘g0.expr` from `generatorURL`.
- #has_required_attributes? ⇒ Boolean
- #monitoring_tool ⇒ Object
- #source ⇒ Object
Methods included from Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods inherited from Base
#alert_params, attribute, #environment, #gitlab_fingerprint, #resolved?, #severity
Methods included from Routing
includes_helpers, redirect_legacy_paths, url_helpers
Instance Method Details
#full_query ⇒ Object
Parses ‘g0.expr` from `generatorURL`.
Example: localhost:9090/graph?g0.expr=vector%281%29&g0.tab=1
72 73 74 75 76 77 78 79 |
# File 'lib/gitlab/alert_management/payload/prometheus.rb', line 72 def full_query return unless generator_url uri = URI(generator_url) Rack::Utils.parse_query(uri.query).fetch('g0.expr') rescue URI::InvalidURIError, KeyError end |
#has_required_attributes? ⇒ Boolean
81 82 83 |
# File 'lib/gitlab/alert_management/payload/prometheus.rb', line 81 def has_required_attributes? project && title && starts_at_raw end |
#monitoring_tool ⇒ Object
65 66 67 |
# File 'lib/gitlab/alert_management/payload/prometheus.rb', line 65 def monitoring_tool Gitlab::AlertManagement::Payload::MONITORING_TOOLS[:prometheus] end |
#source ⇒ Object
85 86 87 |
# File 'lib/gitlab/alert_management/payload/prometheus.rb', line 85 def source integration&.name || monitoring_tool end |