Class: Leafy::Rack::Metrics
- Inherits:
-
Object
- Object
- Leafy::Rack::Metrics
- Defined in:
- lib/leafy/rack/metrics.rb
Constant Summary collapse
- WRITER =
::Leafy::Json::MetricsWriter.new
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, registry, path = '/metrics') ⇒ Metrics
constructor
A new instance of Metrics.
Constructor Details
#initialize(app, registry, path = '/metrics') ⇒ Metrics
Returns a new instance of Metrics.
20 21 22 23 24 |
# File 'lib/leafy/rack/metrics.rb', line 20 def initialize(app, registry, path = '/metrics') @app = app @path = path @registry = registry end |
Class Method Details
.response(metrics, env) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/leafy/rack/metrics.rb', line 11 def self.response( metrics, env ) [ 200, { 'Content-Type' => 'application/json', 'Cache-Control' => 'must-revalidate,no-cache,no-store' }, [ WRITER.to_json( metrics, env[ 'QUERY_STRING' ] == 'pretty' ) ] ] end |