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

   ### Which Issue(s) This PR Fixes
   
   Fixes #7274
   
   ### Brief Description
   
   A step such as `" 30s "` passes `MetricsService` window validation using its 
stripped value but reaches Prometheus with the spaces intact, causing an 
upstream parse error. Strip the outgoing `step` form field in the shared 
Prometheus-compatible transport so it matches the value validated by the 
service, while keeping the caller DTO unchanged.
   
   This preserves existing numeric/duration syntax, positive-step checks and 
sample limits. Related #7055 and #7124 change numeric parsing for #6948; this 
PR changes only HTTP serialization and adds a separate service-to-HTTP 
regression suite.
   
   ### How Did You Test This Change?
   
   Linux ECS, JDK 21 / Maven 3.9.14, with all server inputs checked against a 
Git blob hash manifest before and after the run.
   
   - Red: restore only the production transport to the base revision, keep the 
new regression suite, then run `mvn -B -ntp -Dtest=MetricsStepTransportTest 
test`: **24 tests, 8 assertion failures, 0 errors, 0 skipped**. Only the padded 
form-field cases fail.
   - Green: restore the fix and run `mvn -B -ntp 
-Dtest=MetricsStepTransportTest,PrometheusMetricsSourceTest,MetricsServiceTest,MultiBackendMetricsSourceTest
 test`: **90 tests, 0 failures, 0 errors, 0 skipped**.
   - `mvn -B -ntp clean package -DskipTests`: **BUILD SUCCESS**, compiling all 
729 production and 314 test source files; Checkstyle and the binary JAR license 
gate pass (278 components, existing advisory warnings retained).
   
   The actual ECS commands also select the task's Maven mirror settings and 
dependency cache.
   
   The regression suite runs the actual MetricsService and RestClient against a 
loopback HTTP fixture for both default and configured-data-source queries. It 
asserts decoded form values, successful response parsing and unchanged caller 
DTOs for padded/unpadded numeric and duration steps. Invalid, blank, zero and 
excessive-sampling inputs must produce HTTP 400 locally without contacting the 
fixture. Loopback host validation is overridden only in the test subclass, 
following existing transport tests.
   
   A live Prometheus/Broker process and the MySQL-backed full backend suite 
were not run locally. No frontend code or text changed; full repository checks 
run in GitHub CI.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added for the behavior, new test methods named `...Test`
   - [x] New UI text has both Chinese and English entries — not applicable, no 
UI text
   - [x] Architecture reviewed — transport-only change, no new 
dependencies/layers; full backend CI runs on this PR. No local ArchUnit 
execution is claimed.
   - [x] New source file carries the ASF license header
   - [x] Documentation considered — no documented syntax/API changes
   


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