Class: Fluent::Prometheus::Summary
- Defined in:
- lib/fluent/plugin/prometheus.rb
Instance Attribute Summary
Attributes inherited from Metric
Instance Method Summary collapse
-
#initialize(element, registry, labels) ⇒ Summary
constructor
A new instance of Summary.
- #instrument(record, expander, placeholders) ⇒ Object
Methods inherited from Metric
Constructor Details
#initialize(element, registry, labels) ⇒ Summary
Returns a new instance of Summary.
176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/fluent/plugin/prometheus.rb', line 176 def initialize(element, registry, labels) super if @key.nil? raise ConfigError, "summary metric requires 'key' option" end begin @summary = registry.summary(element['name'].to_sym, element['desc']) rescue ::Prometheus::Client::Registry::AlreadyRegisteredError @summary = Fluent::Prometheus::Metric.get(registry, element['name'].to_sym, :summary, element['desc']) end end |
Instance Method Details
#instrument(record, expander, placeholders) ⇒ Object
189 190 191 192 193 |
# File 'lib/fluent/plugin/prometheus.rb', line 189 def instrument(record, , placeholders) if record[@key] @summary.add(labels(record, , placeholders), record[@key]) end end |