yyqdbngt opened a new pull request, #5842: URL: https://github.com/apache/rocketmq-dashboard/pull/5842
## Why Data source `instanceIds` bindings are persisted exactly as supplied (`DataSourceDTO` accepts any non-blank id), and the instance APIs treat two identifier forms as first-class: the globally unique name and the legacy numeric primary key (`InstanceService.resolveInstanceId()` resolves name-first with a numeric-id fallback). `MetricsService` compared raw strings only: - `queryInstance()` (the `rmq.instance.metrics` tool path) matched bindings by the literal instance name, so a data source bound as the numeric id `"7"` was invisible for instance `instance-a` and the tool failed with `Configure exactly one metrics data source bound to Instance instance-a` (409) even though the source was dedicated to that instance. - `queryByDataSource()` (REST) rejected a request addressed by numeric id for a name-bound source with `Data source ... is not available for instance 7` (400). ## What changed - Both paths now resolve each binding and the requested id to the canonical instance name (`InstanceService.normalizeIdentifier()`) before comparing, so either identifier form matches. Unknown ids keep passing through unchanged and keep failing exactly as before. ## Validation - Red-first tests `MetricsServiceTest#queryInstanceShouldMatchBindingRecordedAsLegacyNumericIdTest` (409 before the fix) and `#queryByDataSourceShouldAcceptLegacyNumericIdForNameBoundSourceTest` (400 before the fix). - `MetricsServiceTest` (33), `MetricsControllerTest` (8) and `InstanceMetricsToolHandlerTest` pass: `mvn -q test -Dtest=MetricsServiceTest,MetricsControllerTest,InstanceMetricsToolHandlerTest` -- 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]
