You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/10/14 14:32:47 UTC

[PR] fix(alerts): parse the 24h statistic's timestamps as UTC [rocketmq-dashboard]

zjncs opened a new pull request, #6666:
URL: https://github.com/apache/rocketmq-dashboard/pull/6666

   ### Which Issue(s) This PR Fixes
   
   Fixes #6665
   
   ### Brief Description
   
   The 本页 24h 触发 statistic parsed each rule's `lastTriggered` with a bare `new Date(...)`, but the value is the backend's UTC wall clock serialized **without an offset** — the lastTriggered *column* on the same page already parses the very same field with `formatUtcDateTime`, whose doc comment documents exactly this pitfall. In a UTC+8 viewer every rule triggered 16–24 hours ago shifted 8 hours out of the window (undercount); in UTC−8 the window overcounted. The column and the statistic disagreed about the same timestamp.
   
   The fix extracts the hardened offset-aware parse into a reusable `parseUtcDate` next to `formatUtcDateTime` (single source of truth for the wire format) and uses it for the statistic.
   
   Non-goals: no change to the wire format or the column rendering, and no other statistics are touched.
   
   ### How Did You Test This Change?
   
   - Red-green: the new test `counts a rule triggered 20 hours ago UTC in the 24h statistic in a non-UTC zone` (stubbed `TZ=Asia/Shanghai`, the established pattern in this suite's sibling tests) failed on the unmodified tree @ `e2f815fb` — the statistic read `0` — and passes after the fix, reading `1`. Re-verified by temporarily restoring the buggy parse on the same base: the test goes red again.
   - `parseUtcDate` itself is unit-tested: offset-less strings parse as UTC, `Z`/`+00:00` forms agree, empty/unparseable input returns `null` instead of an Invalid Date.
   - `npx vitest run src/pages/ops/__tests__/AlertsPage.test.tsx src/utils/format.test.ts` — **64/64 pass**.
   - `npx eslint` on the four touched files — 0 errors (5 pre-existing warnings on untouched lines); `npx tsc --noEmit` — clean.
   
   AI assistance was used; the failure was reproduced before changing production code.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(alerts): parse the 24h statistic's timestamps as UTC [rocketmq-dashboard]

Posted by "zjncs (via GitHub)" <gi...@apache.org>.
zjncs commented on PR #6666:
URL: https://github.com/apache/rocketmq-dashboard/pull/6666#issuecomment-6284294892

   Closing this one myself: the 24h statistic's UTC parsing has landed on the branch as `parseAlertTimestamp` via #5723 (which also reshaped the surrounding `format.ts` helpers — `ratioToPercent`, `parseUtcDateTime` — and the aggregation labels). My `parseUtcDate` variant of the same fix is now redundant against that, and the alert page has moved further in the meantime (percent-unit fixes, window aggregations), so a rebase would just re-litigate a solved problem. Apologies for the noise — my other in-flight fixes (#6657, #6659, #6701) target defects that remain unsolved on the branch.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(alerts): parse the 24h statistic's timestamps as UTC [rocketmq-dashboard]

Posted by "zjncs (via GitHub)" <gi...@apache.org>.
zjncs closed pull request #6666: fix(alerts): parse the 24h statistic's timestamps as UTC
URL: https://github.com/apache/rocketmq-dashboard/pull/6666


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org