Frun1na opened a new pull request, #4775:
URL: https://github.com/apache/rocketmq-dashboard/pull/4775

   ### Which Issue(s) This PR Fixes
   
   None — found by a contract check of the metrics-source authentication 
against the vendor
   documentation; no existing issue tracks it.
   
   ### Brief Description
   
   The Prometheus-compatible metric sources applied bearer authentication 
uniformly as
   `Authorization: Bearer <token>` 
(`AbstractPrometheusCompatibleMetricsSource.applyAuthentication`).
   That breaks ARMS: for V1 Prometheus instances the ARMS HTTP API expects the 
**raw token** in the
   Authorization header. The Aliyun documentation ("使用 HTTP API 地址对接 Grafana 
或自建应用",
   https://help.aliyun.com/zh/arms/prometheus-monitoring/http-api-urls) 
specifies `Authorization: {Token}`
   both in the curl example and in the Grafana custom-header setup, and the 
datasource settings offer no
   custom-header mode, so a data source configured as ARMS + bearer token fails 
every query and the
   connection test with no workaround.
   
   ARMS sources now send the raw token; every other backend (Prometheus / 
VictoriaMetrics / Thanos /
   Mimir / Cortex / Custom) keeps the standard `Bearer` prefix. The datasource 
connection-test path in
   `SettingsService` applies the same rule for the `arms` data source type. 
Basic authentication is
   unchanged and already matches the documented `Basic 
<base64Encode(accessKey:secretKey)>` form.
   
   ### How Did You Test This Change?
   
   ```
   $ mvn -B -ntp -Dtest='MultiBackendMetricsSourceTest' -DfailIfNoTests=false 
test
   [INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0
   [INFO] BUILD SUCCESS
   
   $ mvn -B -ntp -Dtest='SettingsControllerTest,DataSourceTestDTOTest' 
-DfailIfNoTests=false test
   [INFO] Tests run: 24, Failures: 0, Errors: 0, Skipped: 0
   [INFO] BUILD SUCCESS
   ```
   
   The new `armsBearerAuthenticationSendsTheRawToken` spins up an 
`ArmsMetricsSource` against an
   embedded HTTP server and asserts the Authorization header equals the raw 
token. It fails on the
   unfixed code (the header was `Bearer token`). A companion assertion pins the 
unchanged
   `Bearer token` behaviour for the Prometheus backend.
   
   Coverage note: the runtime query path is covered by the new test; the 
`SettingsService` datasource
   connection-test path applies the same rule but that class has no existing 
unit-test seam for the
   auth helper, so it is verified by compilation and the shared rule.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added or updated for non-trivial changes, test methods named 
`...Test`
   - [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks)
   - [ ] New source files carry the ASF license header
   - [ ] Documentation touched where behaviour changed (README / `docs/` / 
in-app help)
   


-- 
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]

Reply via email to