Class: Kube::Cluster::Standard::VictoriaMetrics::Rule
- Inherits:
-
Object
- Object
- Kube::Cluster::Standard::VictoriaMetrics::Rule
- Defined in:
- lib/kube/cluster/standard/victoria_metrics/vm_rule.rb
Overview
A recording rule. The block returns the PromQL expression, so multi-line queries read as a heredoc at the call site.
Instance Method Summary collapse
-
#initialize(name, labels: nil, &block) ⇒ Rule
constructor
A new instance of Rule.
- #to_h ⇒ Object
Constructor Details
#initialize(name, labels: nil, &block) ⇒ Rule
Returns a new instance of Rule.
13 14 15 16 17 |
# File 'lib/kube/cluster/standard/victoria_metrics/vm_rule.rb', line 13 def initialize(name, labels: nil, &block) @name = name @labels = labels @expr = block.call.to_s if block end |
Instance Method Details
#to_h ⇒ Object
19 20 21 22 23 |
# File 'lib/kube/cluster/standard/victoria_metrics/vm_rule.rb', line 19 def to_h h = { record: @name, expr: @expr } h[:labels] = @labels if @labels h end |