Class: Prometheus::CreateDefaultAlertsService
- Inherits:
-
BaseService
- Object
- BaseService
- Prometheus::CreateDefaultAlertsService
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/prometheus/create_default_alerts_service.rb
Constant Summary collapse
- DEFAULT_ALERTS =
[ { identifier: 'response_metrics_nginx_ingress_16_http_error_rate', operator: 'gt', threshold: 0.1 }, { identifier: 'response_metrics_nginx_ingress_http_error_rate', operator: 'gt', threshold: 0.1 }, { identifier: 'response_metrics_nginx_http_error_percentage', operator: 'gt', threshold: 0.1 } ].freeze
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Attributes inherited from BaseService
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project:) ⇒ CreateDefaultAlertsService
constructor
A new instance of CreateDefaultAlertsService.
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(project:) ⇒ CreateDefaultAlertsService
Returns a new instance of CreateDefaultAlertsService.
27 28 29 |
# File 'app/services/prometheus/create_default_alerts_service.rb', line 27 def initialize(project:) @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project
7 8 9 |
# File 'app/services/prometheus/create_default_alerts_service.rb', line 7 def project @project end |
Instance Method Details
#execute ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'app/services/prometheus/create_default_alerts_service.rb', line 31 def execute return ServiceResponse.error(message: 'Invalid project') unless project return ServiceResponse.error(message: 'Invalid environment') unless environment create_alerts schedule_prometheus_update ServiceResponse.success end |