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

   ### Motivation
   
   Each metric mapping in `GET /metrics/profiles` exposes `promql` plus a 
`labels` list. After `sum(...) by (...)`, a Prometheus series only carries the 
labels in the by-clause, so the advertised `labels` must match it — that is 
what the 4.x profile does everywhere (`by (cluster, group, topic)` ↔ labels 
`cluster, group, topic`).
   
   Four mappings in the 5.x native profile violate this: `message_in_tps` / 
`message_out_tps` / `throughput_in` / `throughput_out` aggregate by `(cluster, 
node_id)` / `(cluster, node_id, consumer_group)` but advertise `topic` (and 
`message_type`) as well. Those labels are aggregated away, so the result series 
never carry them. A client that renders one column per advertised label (the 
field is documented as the shape of the mapping's results) shows empty `topic` 
/ `message_type` cells for these panels.
   
   The frontend's own profile mock 
(`web/src/components/__tests__/MetricsExplorer.test.tsx`) already models 
`message_in_tps` as `labels: ['cluster', 'node_id']` — the backend is the 
outlier.
   
   ### Changes
   
   - Trim the advertised labels of the four 5.x TPS/throughput mappings to 
exactly their by-clause sets. No PromQL or query behaviour changes.
   
   ### Verification
   
   `MetricProfileServiceTest`:
   
   - New test 
`everyMappingShouldAdvertiseExactlyTheLabelsItsPromqlAggregatesByTest` parses 
the `by (...)...` clause of every mapping in both profiles and asserts `labels` 
equals it, so future mappings cannot drift again.
   - Updated `mappingsShouldExposeLabelsAndUnitsForDashboardRendering` to the 
corrected label set.
   
   ```
   $ mvn -f server/pom.xml test -Dtest='MetricProfileServiceTest'
   (before) Tests run: 13, Failures: 1, Errors: 0
   (after)  Tests run: 13, Failures: 0, Errors: 0
   ```


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