Class: RailsAiContext::Introspectors::ObservabilityIntrospector
- Inherits:
-
Object
- Object
- RailsAiContext::Introspectors::ObservabilityIntrospector
- Defined in:
- lib/rails_ai_context/introspectors/observability_introspector.rb
Overview
Captures the Rails observability surface: ActiveSupport::Notifications subscribers, LogSubscriber registrations, Server-Timing middleware, the Rails 8.1 structured event reporter, and the well-known Rails event-name catalog. Covers RAILS_NERVOUS_SYSTEM.md §34 (Observability) and §38 (AS::Notifications event catalog).
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(app) ⇒ ObservabilityIntrospector
constructor
A new instance of ObservabilityIntrospector.
Constructor Details
#initialize(app) ⇒ ObservabilityIntrospector
Returns a new instance of ObservabilityIntrospector.
13 14 15 |
# File 'lib/rails_ai_context/introspectors/observability_introspector.rb', line 13 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
11 12 13 |
# File 'lib/rails_ai_context/introspectors/observability_introspector.rb', line 11 def app @app end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rails_ai_context/introspectors/observability_introspector.rb', line 17 def call { log_subscribers: extract_log_subscribers, notification_subscribers: extract_notification_subscribers, server_timing: detect_server_timing, event_reporter: detect_event_reporter, log_level: app.config.log_level.to_s, log_tags: Array(app.config.).map(&:to_s), colorize_logging: !!app.config.colorize_logging, known_events: KNOWN_EVENTS } rescue => e $stderr.puts "[rails-ai-context] ObservabilityIntrospector#call failed: #{e.}" if ENV["DEBUG"] { error: e. } end |