chstercc opened a new issue, #6397: URL: https://github.com/apache/rocketmq-dashboard/issues/6397
### Before Creating the Bug Report - [x] Searched existing issues and PRs for metrics history scope/identity collisions. - [x] This concerns RocketMQ Studio. ### Studio Version `rocketmq-studio`, commit `779b8c0e7aed2396d3cc72743dcd544ea48e9ae6`. ### Runtime Environment Source-level reproduction in the frontend history utility; Linux, Node.js 22.20.0. No live cluster required. ### Connected RocketMQ Cluster Not applicable to the local history identity calculation. ### Describe the Bug Metrics query history uses `instanceId || 'global'` as part of both its deduplication key and its generated entry ID. A supported legacy/unscoped record (missing instanceId) therefore collides with a query for an instance literally named `global`. Instance names are accepted as instance identifiers, and this name is not reserved. Recording the latter query silently removes the former history entry. ### Steps to Reproduce 1. Construct a history entry with `createMetricsQueryHistoryEntry` without an instanceId. 2. Construct another with the same profile, metric, range, source and PromQL, but `instanceId: 'global'`. 3. Call `mergeMetricsQueryHistory([unscoped], scoped)`. 4. The result contains only the scoped entry. If both timestamps are equal, the generated IDs are also equal. ### What Did You Expect to See? Preserve the two distinct query scopes, while still deduplicating repeated queries within one scope. ### What Did You See Instead? One record replaces the other. The same string-sentinel approach is also used for the default data source key. ### Additional Context `web/src/utils/metricsExplorerDiagnostics.ts`: `createMetricsQueryHistoryEntry` and `historyIdentity`. `restoreHistoryEntry` explicitly supports missing instanceId. A structured identity can distinguish absent scope from literal names without changing the persisted entry schema. ### Are You Willing to Submit a Pull Request? - [x] Yes. -- 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]
