Class: Kube::Cluster::Standard::VictoriaMetrics::Alert
- Inherits:
-
Object
- Object
- Kube::Cluster::Standard::VictoriaMetrics::Alert
- Defined in:
- lib/kube/cluster/standard/victoria_metrics/vm_rule.rb
Overview
An alerting rule. The block returns the PromQL expression.
Instance Method Summary collapse
-
#initialize(name, for_: nil, keep_firing_for: nil, labels: nil, annotations: nil, &block) ⇒ Alert
constructor
A new instance of Alert.
- #to_h ⇒ Object
Constructor Details
#initialize(name, for_: nil, keep_firing_for: nil, labels: nil, annotations: nil, &block) ⇒ Alert
Returns a new instance of Alert.
28 29 30 31 32 33 34 35 |
# File 'lib/kube/cluster/standard/victoria_metrics/vm_rule.rb', line 28 def initialize(name, for_: nil, keep_firing_for: nil, labels: nil, annotations: nil, &block) @name = name @for = for_ @keep_firing_for = keep_firing_for @labels = labels @annotations = annotations @expr = block.call.to_s if block end |
Instance Method Details
#to_h ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/kube/cluster/standard/victoria_metrics/vm_rule.rb', line 37 def to_h h = { alert: @name, expr: @expr } h[:for] = @for if @for h[:keep_firing_for] = @keep_firing_for if @keep_firing_for h[:labels] = @labels if @labels h[:annotations] = @annotations if @annotations h end |