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 HTTP tracer. The default label builder can be modified to export a different set of labels per recorded metric.
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.
14 15 16 17 18 19 20 21 22 |
# File 'lib/prometheus/client/rack/collector.rb', line 14 def initialize(app, = {}, &label_builder) @app = app @registry = [:registry] || Client.registry @label_builder = label_builder || DEFAULT_LABEL_BUILDER # The service name should be read from config or could be git repo name @service_name = [:service_name] init_request_metrics init_exception_metrics end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
12 13 14 |
# File 'lib/prometheus/client/rack/collector.rb', line 12 def app @app end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
12 13 14 |
# File 'lib/prometheus/client/rack/collector.rb', line 12 def registry @registry end |
Instance Method Details
#call(env) ⇒ Object
:nodoc:
24 25 26 |
# File 'lib/prometheus/client/rack/collector.rb', line 24 def call(env) # :nodoc: trace(env) { @app.call(env) } end |