mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-10-21 21:31:52 +00:00
imp: split perf info
This commit is contained in:
1 parent
85566a51a5
commit
13ed529d71
1 file changed
+8
@@ -29,6 +29,14 @@ class OdooJsonFormatter(jsonlogger.JsonFormatter):
|
|||||||
record.dbname = getattr(threading.currentThread(), 'dbname', '?')
|
record.dbname = getattr(threading.currentThread(), 'dbname', '?')
|
||||||
record.request_id = getattr(threading.currentThread(), 'request_uuid', None)
|
record.request_id = getattr(threading.currentThread(), 'request_uuid', None)
|
||||||
record.perf_info = getattr(record, 'perf_info', '')
|
record.perf_info = getattr(record, 'perf_info', '')
|
||||||
|
if record.perf_info:
|
||||||
|
nb_queries, time_sql, time_python = record.perf_info.split()
|
||||||
|
time_total = str(float(time_sql) + float(time_python))
|
||||||
|
record.perf_info_nb_queries = nb_queries
|
||||||
|
record.perf_info_time_sql = time_sql
|
||||||
|
record.perf_info_time_python = time_python
|
||||||
|
record.perf_info_time_total = time_total
|
||||||
|
|
||||||
_super = super(OdooJsonFormatter, self)
|
_super = super(OdooJsonFormatter, self)
|
||||||
return _super.add_fields(log_record, record, message_dict)
|
return _super.add_fields(log_record, record, message_dict)
|
||||||
|
|
||||||
|
|||||||