class Monitoring::PrometheusMonitoringRegistry
Prometheus implementation of the monitoring registry, that uses the default registry in the official Prometheus client library.
Public Class Methods
name()
click to toggle source
# File lib/fluent/plugin/monitoring.rb, line 73 def self.name 'prometheus' end
new(_project_id, _monitored_resource, _gcm_service_address)
click to toggle source
Calls superclass method
Monitoring::BaseMonitoringRegistry::new
# File lib/fluent/plugin/monitoring.rb, line 77 def initialize(_project_id, _monitored_resource, _gcm_service_address) super require 'prometheus/client' @registry = Prometheus::Client.registry end
Public Instance Methods
counter(name, _labels, docstring, _prefix, _aggregation)
click to toggle source
Exception-driven behavior to avoid synchronization errors.
# File lib/fluent/plugin/monitoring.rb, line 84 def counter(name, _labels, docstring, _prefix, _aggregation) # When we upgrade to Prometheus client 0.10.0 or higher, pass the # labels in the metric constructor. The 'labels' field in # Prometheus client 0.9.0 has a different function and will not # work as intended. PrometheusCounter.new(@registry.counter(name, docstring)) rescue Prometheus::Client::Registry::AlreadyRegisteredError PrometheusCounter.new(@registry.get(name)) end