zjncs commented on PR #3989:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/3989#issuecomment-5634398085

   Thanks for the thorough review — you're right that hardcoding `group` swaps 
the false positive for a silent false negative on 5.x deployments, which is 
worse.
   
   Reworked as suggested (branch rewritten onto the current `rocketmq-studio`, 
now a single commit on top of it):
   
   - Each `MetricProfileVO.MetricMappingVO` now carries `scopeLabels`, mapping 
canonical scope dimensions (`cluster`/`broker`/`topic`/`consumer_group`) to the 
label name the profile actually exposes — `group` on the 4.x exporter profile, 
`consumer_group` on the 5.x native profile.
   - New `MetricProfileService.resolveCurrentScopeLabel(semanticMetric, scope)` 
resolves the label from the **active profile's mapping for the rule's semantic 
metric** (native metrics via the existing `NATIVE_METRIC_SEMANTIC`; raw 
exporter metric names fall back to the consumer-lag mapping — the export 
default — whose labels document the deployed profile's naming). An unmapped 
dimension resolves empty and the selector is dropped rather than guessed, since 
a wrong label matches an empty series set.
   - The metric name keeps flowing through `resolveCurrentPrometheusMetric` 
from #3987, so on the 4.x profile a `consumer.lag.total` rule now exports as 
`rocketmq_message_accumulation{group="cg-orders"}`, and on 5.x as 
`rocketmq_consumer_lag_messages{consumer_group="cg-orders"}`.
   - Tests cover both profiles: exporter-profile and native-profile 
consumer-group scope, topic/cluster scope on both, wildcard/empty scope still 
bare, plus `resolveCurrentScopeLabelShouldFollowActiveProfileTest` pinning the 
per-profile label table (including empty for dimensions a mapping doesn't break 
out, like `broker` on the lag mapping).
   
   `AlertServiceTest` + `MetricProfileServiceTest` → 93/93 green, fail-before 
on the base branch was 3 failures out of the 4 behavioral tests (the fourth is 
the wildcard guard). Cluster and broker keep their pre-existing literal names — 
both profiles spell them identically; happy to route those through the profile 
too if you'd prefer.


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