Class: PgEventstore::Web::Metrics::MetricFamily
- Inherits:
-
Object
- Object
- PgEventstore::Web::Metrics::MetricFamily
- Defined in:
- lib/pg_eventstore/web/metrics/metric_family.rb,
sig/pg_eventstore/web/metrics/metric_family.rbs
Overview
A collection of samples of a single Prometheus metric.
Instance Attribute Summary collapse
-
#help ⇒ String
Returns the value of attribute help.
-
#name ⇒ String
Returns the value of attribute name.
-
#samples ⇒ Array[Hash[Symbol, untyped]]
Returns the value of attribute samples.
-
#type ⇒ String
Returns the value of attribute type.
Instance Method Summary collapse
- #add_sample(labels:, value:) ⇒ void
-
#initialize(name:, type:, help:) ⇒ MetricFamily
constructor
A new instance of MetricFamily.
Constructor Details
#initialize(name:, type:, help:) ⇒ MetricFamily
Returns a new instance of MetricFamily.
24 25 26 27 28 29 |
# File 'lib/pg_eventstore/web/metrics/metric_family.rb', line 24 def initialize(name:, type:, help:) @name = name @type = type @help = help @samples = [] end |
Instance Attribute Details
#help ⇒ String
Returns the value of attribute help.
16 17 18 |
# File 'lib/pg_eventstore/web/metrics/metric_family.rb', line 16 def help @help end |
#name ⇒ String
Returns the value of attribute name.
10 11 12 |
# File 'lib/pg_eventstore/web/metrics/metric_family.rb', line 10 def name @name end |
#samples ⇒ Array[Hash[Symbol, untyped]]
Returns the value of attribute samples.
19 20 21 |
# File 'lib/pg_eventstore/web/metrics/metric_family.rb', line 19 def samples @samples end |
#type ⇒ String
Returns the value of attribute type.
13 14 15 |
# File 'lib/pg_eventstore/web/metrics/metric_family.rb', line 13 def type @type end |
Instance Method Details
#add_sample(labels:, value:) ⇒ void
This method returns an undefined value.
34 35 36 |
# File 'lib/pg_eventstore/web/metrics/metric_family.rb', line 34 def add_sample(labels:, value:) @samples.push({ labels:, value: }) end |