1
0

fix: remove timestamp rounding in TerseJsonFormatter

The round(record.created, 2) call limits timestamps generated by
TerseJsonFormatter to 10ms precision. This can cause log ordering issues
in log aggregators like Loki when multiple events occur within the same
10ms window.

The rounding was introduced in the original structured logging PR and,
to my knowledge, has no technical benefit.
This commit is contained in:
2025-12-19 22:08:00 -06:00
parent 46c6e0ae1e
commit 198ec9e1f3

View File

@@ -89,7 +89,7 @@ class TerseJsonFormatter(JsonFormatter):
"log": record.getMessage(),
"namespace": record.name,
"level": record.levelname,
"time": round(record.created, 2),
"time": record.created,
}
return self._format(record, event)