Class: Upfluence::HTTP::Middleware::Prometheus
- Inherits:
-
Object
- Object
- Upfluence::HTTP::Middleware::Prometheus
- Defined in:
- lib/upfluence/http/middleware/prometheus.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, registry = ::Prometheus::Client.registry) ⇒ Prometheus
constructor
A new instance of Prometheus.
Constructor Details
#initialize(app, registry = ::Prometheus::Client.registry) ⇒ Prometheus
Returns a new instance of Prometheus.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/upfluence/http/middleware/prometheus.rb', line 8 def initialize(app, registry = ::Prometheus::Client.registry) @registry = registry @request_total_count = @registry.get( :uhttp_handler_requests_total ) || @registry.counter( :uhttp_handler_requests_total, 'Histogram of processed items', ) @request_histogram = @registry.get( :uhttp_handler_requests_duration_second ) || @registry.histogram( :uhttp_handler_requests_duration_second, 'Histogram of processing time', ) @app = app end |
Instance Method Details
#call(env) ⇒ Object
28 29 30 |
# File 'lib/upfluence/http/middleware/prometheus.rb', line 28 def call(env) trace(env) { @app.call(env) } end |