Compare commits

...

2 Commits

Author SHA1 Message Date
1756352106 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.
2025-12-19 22:08:00 -06:00
Eric Eastwood
41938d6fd2 Log the original bind exception when encountering Failed to listen on 0.0.0.0, continuing because listening on [::] (#19297)
**Before:**

```
WARNING - call_when_running - Failed to listen on 0.0.0.0, continuing because listening on [::]
```

**After:**

```
WARNING - call_when_running - Failed to listen on 0.0.0.0, continuing because listening on [::]. Original exception: CannotListenError: Couldn't listen on 0.0.0.0:8008: [Errno 98] Address already in use.
```
2025-12-19 14:29:04 -06:00
3 changed files with 5 additions and 2 deletions

1
changelog.d/19297.misc Normal file
View File

@@ -0,0 +1 @@
Log the original bind exception when encountering `Failed to listen on 0.0.0.0, continuing because listening on [::]`.

View File

@@ -54,7 +54,9 @@ def check_bind_error(
"""
if address == "0.0.0.0" and "::" in bind_addresses:
logger.warning(
"Failed to listen on 0.0.0.0, continuing because listening on [::]"
"Failed to listen on 0.0.0.0, continuing because listening on [::]. Original exception: %s: %s",
type(e).__name__,
str(e),
)
else:
raise e

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)