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

[PR] fix(metrics): keep CSV epochs in one unit [rocketmq-dashboard]

123123213weqw opened a new pull request, #5726:
URL: https://github.com/apache/rocketmq-dashboard/pull/5726

   ## Problem / Evidence
   
   The metrics explorer CSV export mixes time units in one file (`web/src/utils/metricsExplorerDiagnostics.ts`):
   
   - `Timestamp` / `Timestamp ISO` come from Prometheus sample timestamps (epoch **seconds**);
   - `Query Start` / `Query End` are the PromQL window bounds (epoch **seconds**);
   - `Queried At` is the client's `Date.now()` (epoch **milliseconds**), passed straight through.
   
   So one row reads e.g. `Timestamp=1799999…` next to `Queried At=1800000000000` — three orders of magnitude apart with no indication which unit each column uses. Anything consuming the export (a spreadsheet formula, a diff against `Timestamp ISO`) silently computes garbage.
   
   ## Root cause / Fix
   
   `MetricCsvContext.queriedAt` is a wall-clock millisecond value while every other epoch in the row is seconds, and `buildMetricCsvRows` copied it verbatim. The row builder now floors `queriedAt` to seconds so all epoch columns share one unit (the ISO column keeps human-readable verification). The UI history entries keep milliseconds — only the CSV row changes.
   
   ## Tests
   
   - New `keeps every epoch column of a CSV row in the same time unit` in `metricsExplorerDiagnostics.test.ts`: passes a milliseconds `queriedAt` with a seconds window and asserts all three columns are seconds. Fails on the pre-fix code (the row carried `1_800_000_000_000`).
   - `npx vitest run src/utils/metricsExplorerDiagnostics.test.ts src/components/__tests__/MetricsExplorer.test.tsx` → 46/46 passed; `npx tsc --noEmit -p tsconfig.app.json` clean; eslint on touched files clean.
   
   ## Risk
   
   Low. Only the exported CSV's `Queried At` column changes value (ms → s); nothing in the app reads `MetricCsvRow.queriedAt` back.


-- 
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(metrics): keep CSV epochs in one unit [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #5726:
URL: https://github.com/apache/rocketmq-dashboard/pull/5726


-- 
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(metrics): keep CSV epochs in one unit [rocketmq-dashboard]

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

   @lizhimins Refreshed this branch onto the current `rocketmq-studio` — no conflicts, and this PR's own tests pass: lint, `metricsExplorerDiagnostics.test.ts` and `npm run build` green.
   
   One CI note that is not this PR's doing: **Backend Build** is red for every open PR right now — the `binary-license-gate` (`server/pom.xml` → `scripts/legal.py`) fails on the current `rocketmq-studio` HEAD as well, because the spring-ai/swagger-ui/tencentcloud jars carry no embedded LICENSE/COPYING text for the gate to collect. Not something this PR can fix from its own 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