Module: RailsAiBridge::Instrumentation
- Defined in:
- lib/rails_ai_bridge/instrumentation.rb
Overview
Thin wrapper around ActiveSupport::Notifications for rails-ai-bridge events.
Events are namespaced under rails_ai_bridge. If ActiveSupport::Notifications
is not available, the helper yields without instrumentation so the code can be
used outside of Rails without a hard dependency.
Defined Under Namespace
Classes: InstrumentedTool
Constant Summary collapse
- NAMESPACE =
'rails_ai_bridge'
Class Method Summary collapse
-
.instrument(event, payload = {}) { ... } ⇒ Object
Emits an instrumentation event.
Class Method Details
.instrument(event, payload = {}) { ... } ⇒ Object
Emits an instrumentation event.
20 21 22 23 24 25 26 |
# File 'lib/rails_ai_bridge/instrumentation.rb', line 20 def self.instrument(event, payload = {}) return yield unless defined?(ActiveSupport::Notifications) && ActiveSupport::Notifications ActiveSupport::Notifications.instrument("#{NAMESPACE}.#{event}", payload) do yield if block_given? end end |