Class: Monitoring::PrometheusMonitoringRegistry
- Inherits:
-
BaseMonitoringRegistry
- Object
- BaseMonitoringRegistry
- Monitoring::PrometheusMonitoringRegistry
- Defined in:
- lib/fluent/plugin/monitoring.rb
Overview
Prometheus implementation of the monitoring registry, that uses the default registry in the official Prometheus client library.
Class Method Summary collapse
Instance Method Summary collapse
-
#counter(name, labels, docstring) ⇒ Object
Exception-driven behavior to avoid synchronization errors.
-
#initialize(_project_id, _monitored_resource) ⇒ PrometheusMonitoringRegistry
constructor
A new instance of PrometheusMonitoringRegistry.
Methods inherited from BaseMonitoringRegistry
Constructor Details
#initialize(_project_id, _monitored_resource) ⇒ PrometheusMonitoringRegistry
Returns a new instance of PrometheusMonitoringRegistry.
70 71 72 73 74 |
# File 'lib/fluent/plugin/monitoring.rb', line 70 def initialize(_project_id, _monitored_resource) super require 'prometheus/client' @registry = Prometheus::Client.registry end |
Class Method Details
.name ⇒ Object
66 67 68 |
# File 'lib/fluent/plugin/monitoring.rb', line 66 def self.name 'prometheus' end |
Instance Method Details
#counter(name, labels, docstring) ⇒ Object
Exception-driven behavior to avoid synchronization errors.
77 78 79 80 81 |
# File 'lib/fluent/plugin/monitoring.rb', line 77 def counter(name, labels, docstring) return PrometheusCounter.new(@registry.counter(name, docstring, labels)) rescue Prometheus::Client::Registry::AlreadyRegisteredError return PrometheusCounter.new(@registry.get(name)) end |