mirror of
https://github.com/matrix-org/synapse.git
synced 2025-01-14 20:26:52 +00:00
Don't actually one-line the SQL statements we send to the DB (#13129)
This commit is contained in:
parent
13e359aec8
commit
4d3b8fb23f
1
changelog.d/13129.misc
Normal file
1
changelog.d/13129.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Only one-line SQL statements for logging and tracing.
|
@ -366,10 +366,11 @@ class LoggingTransaction:
|
|||||||
*args: P.args,
|
*args: P.args,
|
||||||
**kwargs: P.kwargs,
|
**kwargs: P.kwargs,
|
||||||
) -> R:
|
) -> R:
|
||||||
sql = self._make_sql_one_line(sql)
|
# Generate a one-line version of the SQL to better log it.
|
||||||
|
one_line_sql = self._make_sql_one_line(sql)
|
||||||
|
|
||||||
# TODO(paul): Maybe use 'info' and 'debug' for values?
|
# TODO(paul): Maybe use 'info' and 'debug' for values?
|
||||||
sql_logger.debug("[SQL] {%s} %s", self.name, sql)
|
sql_logger.debug("[SQL] {%s} %s", self.name, one_line_sql)
|
||||||
|
|
||||||
sql = self.database_engine.convert_param_style(sql)
|
sql = self.database_engine.convert_param_style(sql)
|
||||||
if args:
|
if args:
|
||||||
@ -389,7 +390,7 @@ class LoggingTransaction:
|
|||||||
"db.query",
|
"db.query",
|
||||||
tags={
|
tags={
|
||||||
opentracing.tags.DATABASE_TYPE: "sql",
|
opentracing.tags.DATABASE_TYPE: "sql",
|
||||||
opentracing.tags.DATABASE_STATEMENT: sql,
|
opentracing.tags.DATABASE_STATEMENT: one_line_sql,
|
||||||
},
|
},
|
||||||
):
|
):
|
||||||
return func(sql, *args, **kwargs)
|
return func(sql, *args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user