Aias00 opened a new issue, #1986:
URL: https://github.com/apache/rocketmq-dashboard/issues/1986

   ### What happened
   
   The persisted alert-rule editor renders `clusterName` and `brokerName` as a 
PromQL selector in the expression field, but `toAlertRuleRequest` later submits 
the entire `metric{labels}` fragment as `metric` and omits both scope fields.
   
   For example, editing and saving:
   
   ```text
   rocketmq_consumer_lag_messages{cluster="DefaultCluster",broker="broker-a"} > 
100000
   ```
   
   produces a request whose `metric` is `rocketmq_consumer_lag_messages{...}` 
and whose `clusterName`/`brokerName` are absent. The backend exporter only 
accepts a metric identifier and generates selectors from the dedicated scope 
fields, so the next YAML export replaces the invalid metric or loses the 
original scope.
   
   The form also accepts arbitrary label selectors even though the persisted 
backend contract can only represent `cluster` and `broker`.
   
   ### Expected behavior
   
   - Parse the metric identifier separately from supported `cluster="..."` and 
`broker="..."` selectors.
   - Submit the selector values through `clusterName` and `brokerName` on both 
create and update.
   - Preserve scoped rules across edit/save/export round trips.
   - Reject unsupported selectors explicitly instead of persisting a metric 
that the exporter will later replace.
   
   ### Evidence
   
   - `web/src/pages/studio/AlertManagement.tsx`: `buildExpression` adds scope 
labels, while `parseExpression` returns the whole left-hand side as `metric`.
   - 
`server/src/main/java/org/apache/rocketmq/studio/ops/alert/AlertRuleRequestDTO.java`:
 scope has dedicated `clusterName` and `brokerName` fields.
   - `AlertService.expression()` validates the metric identifier separately and 
appends labels from those scope fields.
   
   ### Scope
   
   Track 1 / METRICS-01 alert-rule management. This is distinct from #1957, 
which fixes localized metric and duration values in the separate Ops alert form.


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