bryancall commented on PR #14010:
URL: https://github.com/apache/trafficserver/pull/14010#issuecomment-6747423097
Thanks for turning all of that around so quickly. Everything I asked for is
in and reads well: the two log checks, the diagnostic files page, the plugin
samples, the rename and the upgrade note. I ran `connect_down_policy_4` on
Linux and it passes.
The Linux builds are failing because of the new unit tests. The helper
builds `system_clock::time_point{milliseconds{epoch_ms}}`
([test_ts_iso8601.cc](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/src/tsutil/unit_tests/test_ts_iso8601.cc#L39)).
On macOS that clock counts microseconds, so it can hold the year 0 or 9999. On
Linux it counts nanoseconds in 64 bits, which only reaches about 1677 to 2262,
so the conversion overflows and wraps to a different date. Built on Fedora, I
get:
```
test_ts_iso8601.cc:72: FAILED:
REQUIRE( format(-30'627'458'703'211) == "0999-06-15T12:34:56.789Z" )
with expansion:
"2168-07-24T11:44:04.208Z"
```
and the 0000-01-01 case comes back as `1753-08-29T22:43:41.128Z`. The
formatter itself is fine. It's the two new sections ([lines
70-81](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/src/tsutil/unit_tests/test_ts_iso8601.cc#L70-L81))
asking for times the Linux clock can't represent. That also means the year
check in
[ts_iso8601.cc](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/src/tsutil/ts_iso8601.cc#L52)
can only be reached on macOS.
Either fix is fine with me:
- **Keep the coverage everywhere.** Move the field formatting into a small
function that takes the seconds as a `time_t` plus the milliseconds, have
`format_iso8601_utc` call it, and point the year 0, 999 and 9999 cases at that.
A 64-bit `time_t` reaches those years on every platform, so the padding and the
range check get tested on Linux too. `ts_iso8601.h` is installed with the other
tsutil headers, so if you want to change the signature itself, now is the cheap
time to do it.
- **Skip those two sections where the clock can't hold the value.** The
check has to go at the top of each `SECTION`, before the `REQUIRE`s. Calling
`SKIP` from inside `format()` doesn't work: it fires inside the `REQUIRE` and
Catch2 counts it as a failure (I tried). This version passes on Linux:
```cpp
// libstdc++ counts system_clock in nanoseconds, which only reaches the
years 1677 to 2262.
bool
clock_holds(int64_t epoch_ms)
{
return epoch_ms >=
duration_cast<milliseconds>(system_clock::duration::min()).count() &&
epoch_ms <=
duration_cast<milliseconds>(system_clock::duration::max()).count();
}
```
```cpp
if (!clock_holds(-62'167'219'200'001) ||
!clock_holds(253'402'300'800'000)) {
SKIP("system_clock cannot hold years 0 to 10000 here");
}
```
One more ask while the format is changing anyway: drop the square brackets.
diags.log and traffic.out still wrap the stamp, `[2026-10-08T18:58:01.123Z]`,
while error.log and the plugin logs don't, so the logs still start two
different ways. The brackets come from the existing `"[{}] "` in
[DbgCtl.cc](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/src/tsutil/DbgCtl.cc#L348).
Everyone who parses these logs has to change for this PR anyway, so this is
the cheap time to make them match: every line would start
`2026-10-08T18:58:01.123Z traffic_server NOTE: ...`. That's the print in
DbgCtl.cc changing to `"{} "`, the `diags_log` rule in connect_down_policy_4
losing its `\[` and `\]`, the upgrade note's table, and the samples in
diagnostic-files, cookie_remap and a-simple-plugin.
Two more doc samples change with this PR. ja4_fingerprint and
jax_fingerprint open their logs with `TS_LOG_MODE_ADD_TIMESTAMP`, the same as
tcpinfo, so their lines now start like `error.log`. Their examples still show
`[Jan 29 10:15:23.456] Client IP: ...`
([ja4_fingerprint.en.rst](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/doc/admin-guide/plugins/ja4_fingerprint.en.rst#L122-L123),
[jax_fingerprint.en.rst](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/doc/admin-guide/plugins/jax_fingerprint.en.rst#L308-L309)).
They should read `2026-01-29T10:15:23.456Z Client IP: ...`, with no brackets.
For the lua follow-up: its sample matches what it prints today, because
ts_lua writes its own stamp
([ts_lua.cc](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/plugins/lua/ts_lua.cc#L242))
instead of going through diags. So that one needs a code change, not just a
doc edit. regex_remap's page has no stamp sample, so there is nothing to do
there.
One small thing, not blocking: the [cookie_remap
samples](https://github.com/apache/trafficserver/blob/d655d2136459d61fb4c86cd4109a7307ab40a66b/doc/admin-guide/plugins/cookie_remap.en.rst#L461-L464)
still carry `Server {3187168}` after the new stamp, which current builds don't
print. Fine to leave.
Once the Linux builds are green, I think this is ready to come out of draft.
I've attached a short explainer of the change for the meeting: the before
and after stamps, where the change lands, and the bracket and settings
questions below (PDF, with the HTML in a zip).
We'll go over this PR at today's ATS PR and Issue Scrub: Monday, November 9,
3:00 to 4:00 PM Pacific (23:00 to 00:00 UTC), on Google Meet at
https://meet.google.com/mnv-ucrg-kth. You're welcome to join. Besides the Linux
test fix and the brackets, Leif raised whether the log timestamp format should
be configurable. My thought is one global setting, with this format as the
default and a legacy option that keeps the old stamps for anyone who can't
change their parsers yet, added in a follow-up PR before 11.0.0 rather than in
this one. If the time doesn't work for you, that's fine. I'll post a summary
here afterwards.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]