FEATURE: Add `live_slots_(start|finish)` for Sidekiq perf logging (#28260)

This information is helpful in debugging memory spikes when Sidekiq
processes jobs.
This commit is contained in:
Alan Guo Xiang Tan 2024-08-07 15:48:24 +08:00 committed by GitHub
parent 66a23180d4
commit 1a09d6b246
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -69,6 +69,7 @@ module Jobs
MethodProfiler.ensure_discourse_instrumentation!
MethodProfiler.start
@data["live_slots_start"] = GC.stat[:heap_live_slots]
end
end
@ -86,6 +87,7 @@ module Jobs
@data["redis_calls"] = profile.dig(:redis, :calls) || 0 # Redis commands
@data["net_duration"] = profile.dig(:net, :duration) || 0 # Redis Duration (s)
@data["net_calls"] = profile.dig(:net, :calls) || 0 # Redis commands
@data["live_slots_finish"] = GC.stat[:heap_live_slots]
if exception.present?
@data["exception"] = exception # Exception - if job fails a json encoded exception