Class: Prometheus::Client::Rack::Collector
- Inherits:
-
Object
- Object
- Prometheus::Client::Rack::Collector
- Defined in:
- lib/prometheus/client/rack/collector.rb
Overview
Collector is a Rack middleware that provides a sample implementation of a Prometheus HTTP client API.
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
-
#call(env) ⇒ Object
:nodoc:.
-
#initialize(app, options = {}, &label_builder) ⇒ Collector
constructor
A new instance of Collector.
Constructor Details
#initialize(app, options = {}, &label_builder) ⇒ Collector
Returns a new instance of Collector.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/prometheus/client/rack/collector.rb', line 13 def initialize(app, = {}, &label_builder) @app = app @registry = [:registry] || Client.registry @label_builder = label_builder || proc do |env| { method: env['REQUEST_METHOD'].downcase, path: env['PATH_INFO'].to_s, } end init_request_metrics init_exception_metrics end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
11 12 13 |
# File 'lib/prometheus/client/rack/collector.rb', line 11 def app @app end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
11 12 13 |
# File 'lib/prometheus/client/rack/collector.rb', line 11 def registry @registry end |
Instance Method Details
#call(env) ⇒ Object
:nodoc:
27 28 29 |
# File 'lib/prometheus/client/rack/collector.rb', line 27 def call(env) # :nodoc: trace(env) { @app.call(env) } end |