Class: Prometheus::ProxyVariableSubstitutionService
- Inherits:
-
BaseService
- Object
- BaseService
- Prometheus::ProxyVariableSubstitutionService
- Includes:
- Stepable
- Defined in:
- app/services/prometheus/proxy_variable_substitution_service.rb
Constant Summary collapse
- VARIABLE_INTERPOLATION_REGEX =
/ {{ # Variable needs to be wrapped in these chars. \s* # Allow whitespace before and after the variable name. (?<variable> # Named capture. \w+ # Match one or more word characters. ) \s* }} /x.freeze
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
-
#execute ⇒ Object
Example output:.
-
#initialize(environment, params = {}) ⇒ Prometheus::ProxyVariableSubstitutionService
constructor
Example: Prometheus::ProxyVariableSubstitutionService.new(environment, { params: { start_time: '2020-07-03T06:08:36Z', end_time: '2020-07-03T14:08:52Z', query: 'upinstance=“{{instance}”}', variables: { instance: 'srv1' } } }).
Methods included from Stepable
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(environment, params = {}) ⇒ Prometheus::ProxyVariableSubstitutionService
Example:
Prometheus::ProxyVariableSubstitutionService.new(environment, {
params: {
start_time: '2020-07-03T06:08:36Z',
end_time: '2020-07-03T14:08:52Z',
query: 'up{instance="{{instance}}"}',
variables: { instance: 'srv1' }
}
})
43 44 45 46 |
# File 'app/services/prometheus/proxy_variable_substitution_service.rb', line 43 def initialize(environment, params = {}) @environment = environment @params = params.deep_dup end |
Instance Method Details
#execute ⇒ Object
Example output:
params: {
start_time: '2020-07-03T06:08:36Z',
start: '2020-07-03T06:08:36Z',
end_time: '2020-07-03T14:08:52Z',
end: '2020-07-03T14:08:52Z',
query: 'up{instance="srv1"',
variables: { instance: 'srv1' }
}
}
69 70 71 |
# File 'app/services/prometheus/proxy_variable_substitution_service.rb', line 69 def execute execute_steps end |