zjncs opened a new pull request, #5204:
URL: https://github.com/apache/rocketmq-dashboard/pull/5204
### Which Issue(s) This PR Fixes
- Fixes #<issue-id>
### Brief Description
The consumer stack modal's 采集时间 (capture time) is wrong for every viewer
outside the server's timezone, in the same two ways the DLQ last-enqueue-time
was:
1. **Backend**: `toStackTrace` stamped `capturedAt` with
`LocalDateTime.now()` — the JVM default zone. `LocalDateTime` serializes
without an offset, so the wire value was a wall clock in whatever zone the
server runs in. It now captures with `LocalDateTime.now(ZoneOffset.UTC)`,
matching the backend-wide UTC convention the metrics and alert subsystems set.
2. **Frontend**: the stack modal rendered it with the local-parse
`formatDateTime`, whose `new Date(value)` treats an offset-less string as the
viewer's zone — a UTC server and a Shanghai viewer saw the capture time 8 hours
early. It now renders through `formatUtcDateTime` (the helper the
user-management timestamps fix introduced), which reads offset-less strings as
UTC and renders in the viewer's zone with a `GMT+X` suffix.
Same pairing as #5197 for the DLQ group list; this is the consumer
diagnostics surface, so it ships separately.
### How Did You Test This Change?
Backend — new `getConsumerStackShouldStampTheCaptureTimeAsUtcTest`: the JVM
default zone forced to `Asia/Shanghai` (a default-zone capture is then 8 hours
ahead of UTC), asserting the captured time is within 60 seconds of
`LocalDateTime.now(ZoneOffset.UTC)`:
```
$ mvn test -Dtest=RocketMQConsumerDiagnosticsProviderTest
Tests run: 12, Failures: 0 # 11 before; on the old LocalDateTime.now()
the drift
# assertion fails against the 8-hour gap
```
Frontend — new `renders the stack capture time in the viewer timezone from
the offset-less UTC wire format`: `capturedAt: '2026-07-23T00:00:00'` (the real
Jackson shape — no `Z`), `TZ` stubbed to `Asia/Shanghai`, asserting the modal
shows `2026-07-23 08:00:00 GMT+8`:
```
$ NODE_OPTIONS=--no-experimental-webstorage npx --prefix web vitest run
--root web src/pages/instance/__tests__/ConsumerPage.test.tsx
Test Files 1 passed (1)
Tests 37 passed (37) # 36 before; the old formatDateTime render
shows
# 00:00:00 with no zone and the assertion
fails
$ npx --prefix web tsc -p web --noEmit # clean
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(no new UI text)
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header (no new files)
- [x] Documentation touched where behaviour changed (bug fix; displayed
value now correct)
--
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]