Class: TypedCache::Instrumenters::Monitor
- Inherits:
-
Object
- Object
- TypedCache::Instrumenters::Monitor
- Defined in:
- lib/typed_cache/instrumenters/monitor.rb
Instance Method Summary collapse
-
#instrument(operation, key, **payload, &block) ⇒ Object
: [R] (String, String, **untyped) { -> R } -> R.
- #subscribe(operation, **filters, &block) ⇒ Object
Methods included from TypedCache::Instrumenters::Mixins::NamespacedSingleton
all, included, #initialize, #namespace
Methods included from TypedCache::Instrumenter
Instance Method Details
#instrument(operation, key, **payload, &block) ⇒ Object
: [R] (String, String, **untyped) { -> R } -> R
13 14 15 16 17 18 |
# File 'lib/typed_cache/instrumenters/monitor.rb', line 13 def instrument(operation, key, **payload, &block) return yield unless enabled? payload = build_payload(operation, key, **payload) Dry::Monitor::Notifications.instrument(event_name(operation), payload, &block) end |
#subscribe(operation, **filters, &block) ⇒ Object
22 23 24 |
# File 'lib/typed_cache/instrumenters/monitor.rb', line 22 def subscribe(operation, **filters, &block) Dry::Monitor::Notifications.subscribe(event_name(operation), **filters, &block) end |