mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Seperate concerns of tracking GC stat from MethodProfiler (#22921)
Why this change?
This is a follow up to e8f7b62752.
Tracking of GC stats didn't really belong in the `MethodProfiler` class
so we want to extract that concern into its own class.
As part of this PR, the `track_gc_stat_per_request` site setting has
also been renamed to `instrument_gc_stat_per_request`.
This commit is contained in:
committed by
GitHub
parent
e8f7b62752
commit
773b22e8d0
@@ -201,6 +201,7 @@ class Middleware::RequestTracker
|
||||
def call(env)
|
||||
result = nil
|
||||
info = nil
|
||||
gc_stat_timing = nil
|
||||
|
||||
# doing this as early as possible so we have an
|
||||
# accurate counter
|
||||
@@ -225,7 +226,13 @@ class Middleware::RequestTracker
|
||||
env["discourse.request_tracker"] = self
|
||||
|
||||
MethodProfiler.start
|
||||
result = @app.call(env)
|
||||
|
||||
if SiteSetting.instrument_gc_stat_per_request
|
||||
gc_stat_timing = GCStatInstrumenter.instrument { result = @app.call(env) }
|
||||
else
|
||||
result = @app.call(env)
|
||||
end
|
||||
|
||||
info = MethodProfiler.stop
|
||||
|
||||
# possibly transferred?
|
||||
@@ -263,7 +270,11 @@ class Middleware::RequestTracker
|
||||
end
|
||||
end
|
||||
end
|
||||
log_request_info(env, result, info, request) if !env["discourse.request_tracker.skip"]
|
||||
|
||||
if !env["discourse.request_tracker.skip"]
|
||||
info.merge!(gc_stat_timing) if gc_stat_timing
|
||||
log_request_info(env, result, info, request)
|
||||
end
|
||||
end
|
||||
|
||||
def log_later(data)
|
||||
|
||||
Reference in New Issue
Block a user