Frun1na opened a new issue, #6107: URL: https://github.com/apache/rocketmq-dashboard/issues/6107
### Before Creating the Bug Report - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository and believe that this is not a duplicate. - [x] This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository. - [x] I can reproduce this on the current `rocketmq-studio` branch, or I have stated the exact version I am running below. ### Studio Version branch: `rocketmq-studio` git commit id: `5e4c39b0` deployed as: reproduced by unit tests against that commit (the affected code is the backend metrics source) ### Runtime Environment OS: Ubuntu on WSL2 MySQL: not applicable — reproduced against a loopback HTTP server in a JUnit 5 test browser: not applicable for the reproduction; the console's own auth values are quoted below ### Connected RocketMQ Cluster RocketMQ version: not applicable — the failing request is the Prometheus-compatible data source query access mode: not applicable deployment: not applicable ### Describe the Bug A metrics data source that requires credentials cannot be queried, even though it saves and passes its own connection test. Two vocabularies name the same authentication modes: - The console (`web/src/pages/settings/DataSourceTab.tsx:534`) offers `Basic Auth` and `Bearer Token`; `SettingsService.normalizeAuth` (`server/src/main/java/org/apache/rocketmq/studio/settings/SettingsService.java:363`) canonicalizes those to `basic auth` / `bearer token`, which is also what its constants `AUTH_BASIC` / `AUTH_BEARER` and its connection test compare against. - The legacy `studio.prometheus` properties carry `basic` / `bearer` (`PrometheusMetricsSource.legacyAuthType`). `AbstractPrometheusCompatibleMetricsSource.applyAuthentication` (`server/src/main/java/org/apache/rocketmq/studio/cluster/metrics/AbstractPrometheusCompatibleMetricsSource.java:203`) matched only the legacy values, so a stored `basic auth` / `bearer token` fell into the `default` branch and every query against that data source answered ``` PrometheusException: Unsupported Prometheus authentication mode: basic auth (HTTP 503) ``` The Metrics Explorer, the dashboards and the instance-bound tool query all build their source from the stored configuration (`MetricsService.toConfig` → `MetricsSourceFactory.create`), so the failure is not specific to one page, and the "test connection" button reports success because it authenticates through the other vocabulary. ### Steps to Reproduce 1. Settings → data sources: create a Prometheus-compatible source with authentication `Basic Auth` plus a username and password. The connection test succeeds. 2. Query it from the Metrics Explorer: the backend answers `503 Unsupported Prometheus authentication mode: basic auth`. 3. Or run the regression tests: ``` cd server && mvn -B -ntp test -Dtest=MultiBackendMetricsSourceTest storedBasicAuthModeShouldSendTheCredentialsTest: PrometheusException: Unsupported Prometheus authentication mode: basic auth ``` ### What Did You Expect to See? The query carries the configured credentials (`Authorization: Basic …` for `Basic Auth`, `Authorization: Bearer …` for `Bearer Token`) and returns the series, the same way the legacy `studio.prometheus` configuration and the connection test already behave. ### What Did You See Instead? `503` with `Unsupported … authentication mode: basic auth` / `bearer token` / `Basic Auth` — for a mode the repository defines as a constant and the connection test accepts. Only an unauthenticated data source (`none`) can be queried. ### Additional Context A fix with regression tests follows in a pull request. ### Are You Willing to Submit a Pull Request? - [x] Yes, I am willing to submit a pull request. -- 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]
