Class: Async::App::WebApps::MetricsApp
- Inherits:
-
Object
- Object
- Async::App::WebApps::MetricsApp
- Includes:
- AutoloadComponent, Async::App::WebComponent
- Defined in:
- lib/async/app/web_apps/metrics_app.rb
Constant Summary collapse
- PATHS =
["/metrics", "/metrics/"].freeze
Instance Method Summary collapse
Methods included from AutoloadComponent
Methods included from Async::App::WebComponent
Instance Method Details
#after_init ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/async/app/web_apps/metrics_app.rb', line 11 def after_init store = Store.new @serializer = Serializer.new(prefix: async_app_name, store:) bus.subscribe("metrics.updated") do |metrics| metrics.each { store.set(_1, **_2) } end end |
#call ⇒ Object
21 |
# File 'lib/async/app/web_apps/metrics_app.rb', line 21 def call(*) = [200, {}, @serializer.serialize] |
#can_handle?(request) ⇒ Boolean
20 |
# File 'lib/async/app/web_apps/metrics_app.rb', line 20 def can_handle?(request) = PATHS.include?(request.path) |