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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
