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 26
def self.name
  'prometheus'
end
new() click to toggle source
# File lib/fluent/plugin/monitoring.rb, line 30
def initialize
  require 'prometheus/client'
  @registry = Prometheus::Client.registry
end

Public Instance Methods

counter(name, desc) click to toggle source

Exception-driven behavior to avoid synchronization errors.

# 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