Class: Fluent::Plugin::PrometheusMetrics

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/prometheus_metrics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePrometheusMetrics

Returns a new instance of PrometheusMetrics.



9
10
11
12
# File 'lib/fluent/plugin/prometheus_metrics.rb', line 9

def initialize
  @comments = []
  @metrics = []
end

Instance Attribute Details

#comments=(value) ⇒ Object (writeonly)

Sets the attribute comments

Parameters:

  • value

    the value to set the attribute comments to.



26
27
28
# File 'lib/fluent/plugin/prometheus_metrics.rb', line 26

def comments=(value)
  @comments = value
end

#metrics=(value) ⇒ Object (writeonly)

Sets the attribute metrics

Parameters:

  • value

    the value to set the attribute metrics to.



26
27
28
# File 'lib/fluent/plugin/prometheus_metrics.rb', line 26

def metrics=(value)
  @metrics = value
end

Instance Method Details

#add_comment(comment) ⇒ Object



18
19
20
# File 'lib/fluent/plugin/prometheus_metrics.rb', line 18

def add_comment(comment)
  @comments << comment
end

#add_metric_value(value) ⇒ Object



22
23
24
# File 'lib/fluent/plugin/prometheus_metrics.rb', line 22

def add_metric_value(value)
  @metrics << value
end

#to_stringObject



14
15
16
# File 'lib/fluent/plugin/prometheus_metrics.rb', line 14

def to_string
  (@comments + @metrics).join("\n")
end