Class: Prometheus::Client::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/prometheus/client/container.rb

Overview

Metric Container

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, docstring, metric, base_labels) ⇒ Container

Returns a new instance of Container.



9
10
11
12
13
14
# File 'lib/prometheus/client/container.rb', line 9

def initialize(name, docstring, metric, base_labels)
  @name = name
  @docstring = docstring
  @metric = metric
  @base_labels = LabelSet.new(base_labels)
end

Instance Attribute Details

#base_labelsObject (readonly)

Returns the value of attribute base_labels.



7
8
9
# File 'lib/prometheus/client/container.rb', line 7

def base_labels
  @base_labels
end

#docstringObject (readonly)

Returns the value of attribute docstring.



7
8
9
# File 'lib/prometheus/client/container.rb', line 7

def docstring
  @docstring
end

#metricObject (readonly)

Returns the value of attribute metric.



7
8
9
# File 'lib/prometheus/client/container.rb', line 7

def metric
  @metric
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/prometheus/client/container.rb', line 7

def name
  @name
end

Instance Method Details

#to_json(*json) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/prometheus/client/container.rb', line 16

def to_json(*json)
  {
    'baseLabels' => base_labels.merge(:name => name),
    'docstring'  => docstring,
    'metric'     => metric
  }.to_json(*json)
end