You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "tju-yxq (via GitHub)" <gi...@apache.org> on 2026/09/03 18:19:53 UTC

[I] Native alert metric validation and testing use inconsistent normalization [rocketmq-dashboard]

tju-yxq opened a new issue, #3049:
URL: https://github.com/apache/rocketmq-dashboard/issues/3049

   ## Problem
   
   Native alert metric handling normalizes the metric inconsistently and, in the rule-test path, does not normalize it at all:
   
   - `AlertRuleController` converts the request DTO to `AlertRuleVO` without trimming the metric.
   - `NativeAlertRulePolicy` compares the untrimmed metric against native metric names, so a whitespace-padded native metric can bypass domain, instance, operator, scope, duration, and sample-count validation.
   - `NativeAlertRuleTestService` then filters samples with `rule.getMetric().equals(sample.metricKey())`, while `AlertRuleEvaluator` uses `rule.getMetric().trim().equals(...)`. A padded metric therefore tends to return zero samples after validation has already bypassed policy checks.
   - `AlertNotificationTemplate` and `AlertRuleSemanticFingerprint` also use the raw metric for percentage formatting and ratio normalization, so the same semantic rule can behave differently depending on invisible whitespace.
   
   Issue #2951 and open PR #2960 describe this general problem and propose normalizing inside the metric catalog. That is narrower than the actual surface: the catalog is only one of several callers, and the test path calls `NativeAlertRulePolicy` and the sample filter before/without relying on that catalog normalization.
   
   ## Expected behavior
   
   Normalize the metric once at the API boundary (`AlertRuleRequestDTO.toAlertRuleVO()`), so policy validation, catalog validation, test sample filtering, evaluation, notification rendering, semantic fingerprints, persistence, exports, and imports all see the same canonical key. Existing rules with padded metrics should also be normalized on update and transfer import rather than being silently preserved.
   
   This issue is filed as a broader boundary-normalization follow-up to #2951/#2960, not a request to take over that PR.


-- 
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: commits-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Native alert metric validation and testing use inconsistent normalization [rocketmq-dashboard]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #3049:
URL: https://github.com/apache/rocketmq-dashboard/issues/3049#issuecomment-5531448721

   **Issue Evaluation**
   
   Category: `bug` | Status: **Confirmed**
   
   The reported inconsistency in metric normalization is a valid concern. The issue correctly identifies that:
   1. AlertRuleController does not trim the metric before validation
   2. Different code paths use inconsistent normalization (trimmed vs untrimmed)
   3. This can lead to validation bypass and inconsistent behavior
   
   **Root Cause:** Missing normalization at the controller level, with inconsistent handling downstream.
   **Impact:** Security (validation bypass), correctness (inconsistent rule behavior)
   **Severity:** Medium
   
   **Recommendation:** Normalize (trim) the metric field at the controller level before any validation or storage. Ensure all downstream code paths use the normalized value consistently.
   
   An automated fix proposal can be generated. Reply `/approve` to proceed with PR generation.
   
   ---
   *Automated evaluation by RockteMQ-AI*
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Native alert metric validation and testing use inconsistent normalization [rocketmq-dashboard]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #3049:
URL: https://github.com/apache/rocketmq-dashboard/issues/3049#issuecomment-5533779360

   **Issue Evaluation**
   
   Category: `bug` | Status: **Confirmed**
   
   The validation bypass is a real issue. The inconsistency between `AlertRuleController` (no trim) and `NativeAlertRulePolicy` (compares untrimmed) means whitespace-padded metrics can bypass validation.
   
   **Root Cause:** Missing `trim()` in the DTO-to-VO conversion path.
   **Impact:** Security — invalid alert rules can bypass validation.
   **Severity:** medium
   
   ---
   *Automated evaluation by github-manager-bot*


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Native alert metric validation and testing use inconsistent normalization [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed issue #3049: Native alert metric validation and testing use inconsistent normalization
URL: https://github.com/apache/rocketmq-dashboard/issues/3049


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Native alert metric validation and testing use inconsistent normalization [rocketmq-dashboard]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #3049:
URL: https://github.com/apache/rocketmq-dashboard/issues/3049#issuecomment-5537663255

   **Issue Evaluation**
   
   Category: `bug` | Status: **Confirmed**
   
   Inconsistent normalization between validation and testing of alert metrics is a legitimate bug. This can cause metrics to pass validation but fail in tests (or vice versa), leading to confusing behavior.
   
   **Impact:** Alert metric configuration reliability
   **Severity:** Medium
   
   A fix should ensure the same normalization logic is used in both validation and testing paths.
   
   ---
   *Automated evaluation by RockteMQ-AI*
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Native alert metric validation and testing use inconsistent normalization [rocketmq-dashboard]

Posted by "tju-yxq (via GitHub)" <gi...@apache.org>.
tju-yxq commented on issue #3049:
URL: https://github.com/apache/rocketmq-dashboard/issues/3049#issuecomment-5530244925

   Implemented in #3050.
   
   The patch normalizes the metric at the DTO boundary, normalizes metric/instance/operator in the native rule-test path before policy and sample filtering, and trims imported metrics before catalog validation. It intentionally does not take over #2960; that PR remains a narrower catalog-boundary proposal.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Native alert metric validation and testing use inconsistent normalization [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on issue #3049:
URL: https://github.com/apache/rocketmq-dashboard/issues/3049#issuecomment-5537979526

   Resolved by #3050 (merged into rocketmq-studio as 67a62191).


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org