Class: Monitoring::PrometheusMonitoringRegistry

Inherits:
BaseMonitoringRegistry show all
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

Constructor Details

#initializePrometheusMonitoringRegistry

Returns a new instance of PrometheusMonitoringRegistry.



30
31
32
33
# File 'lib/fluent/plugin/monitoring.rb', line 30

def initialize
  require 'prometheus/client'
  @registry = Prometheus::Client.registry
end

Class Method Details

.nameObject



26
27
28
# File 'lib/fluent/plugin/monitoring.rb', line 26

def self.name
  'prometheus'
end

Instance Method Details

#counter(name, desc) ⇒ Object

Exception-driven behavior to avoid synchronization errors.



36
37
38
39
40
# File 'lib/fluent/plugin/monitoring.rb', line 36

def counter(name, desc)
  return @registry.counter(name, desc)
rescue Prometheus::Client::Registry::AlreadyRegisteredError
  return @registry.get(name)
end