Add more metrics to lograge's output if `MethodProfiler` is enabled.

This commit is contained in:
Guo Xiang Tan 2017-11-25 08:10:49 +08:00
parent 39d7745dc5
commit b907f7d307
1 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,15 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
database: RailsMultisite::ConnectionManagement.current_db,
}
if data = Thread.current[:_method_profiler]
sql = data[:sql]
output[:db] = sql[:duration] * 1000
output[:db_calls] = sql[:calls]
redis = data[:redis]
output[:redis] = redis[:duration] * 1000
output[:redis_calls] = redis[:calls]
end
output
end