Class: RailsErrorDashboard::Services::DiagnosticDumpGenerator
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Services::DiagnosticDumpGenerator
- Defined in:
- lib/rails_error_dashboard/services/diagnostic_dump_generator.rb
Overview
Pure algorithm: Capture on-demand diagnostic snapshot of current system state
Aggregates data from existing services (zero duplication):
-
SystemHealthSnapshot: GC, memory, threads, connection pool, Puma, job queue
-
EnvironmentSnapshot: Ruby/Rails versions, gems, server, DB adapter
-
BreadcrumbCollector: Current thread’s breadcrumb buffer (non-destructive)
Additional data unique to diagnostic dumps:
-
Per-thread info (name, status, alive)
-
Full GC.stat (SystemHealthSnapshot only captures a subset)
-
ObjectSpace.count_objects (O(1) type counts — NOT each_object)
-
Process uptime
SAFETY RULES (HOST_APP_SAFETY.md):
-
Every section individually wrapped in rescue => nil
-
Never raises — returns partial dump on error
-
No ObjectSpace.each_object (banned rule #8)
-
No Thread.list.map(&:backtrace) (GVL hold)
-
No Signal.trap (banned rule #9)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call ⇒ Object
25 26 27 |
# File 'lib/rails_error_dashboard/services/diagnostic_dump_generator.rb', line 25 def self.call new.call end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rails_error_dashboard/services/diagnostic_dump_generator.rb', line 29 def call { captured_at: Time.current.iso8601, pid: Process.pid, uptime_seconds: process_uptime, environment: environment_info, system_health: system_health, breadcrumbs: , threads: thread_info, gc: gc_info, object_counts: object_counts } rescue => e { captured_at: Time.current.iso8601, error: e. } end |