module Prometheus::Client
Client
is a ruby implementation for a Prometheus
compatible client.
Client
is a ruby implementation for a Prometheus
compatible client.
Constants
- VERSION
Attributes
configuration[W]
Public Class Methods
configuration()
click to toggle source
# File lib/prometheus/client.rb, line 11 def configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/prometheus/client.rb, line 15 def configure yield(configuration) end
logger()
click to toggle source
# File lib/prometheus/client.rb, line 24 def logger configuration.logger end
pid()
click to toggle source
# File lib/prometheus/client.rb, line 28 def pid configuration.pid_provider.call end
registry()
click to toggle source
Returns a default registry object
# File lib/prometheus/client.rb, line 20 def registry @registry ||= Registry.new end
reinitialize_on_pid_change(force: false)
click to toggle source
With `force: false`: reinitializes metric files only for processes with the changed PID. With `force: true`: reinitializes all metrics files. Always keeps the registry. Use case (`force: false`): pick up new metric files on each worker start, without resetting already registered files for the master or previously initialized workers.
# File lib/prometheus/client.rb, line 45 def reinitialize_on_pid_change(force: false) if force ::Prometheus::Client::MmapedValue.reset_and_reinitialize else ::Prometheus::Client::MmapedValue.reinitialize_on_pid_change end end
reset!()
click to toggle source
Resets the registry and reinitializes all metrics files. Use case: clean up everything in specs `before` block, to prevent leaking the state between specs which are updating metrics.
# File lib/prometheus/client.rb, line 35 def reset! @registry = nil ::Prometheus::Client::MmapedValue.reset_and_reinitialize end