youngkermit8-coder opened a new issue, #7322:
URL: https://github.com/apache/rocketmq-dashboard/issues/7322
### Before Creating the Bug Report
- [x] I searched this repository's open issues and related closed work and
believe this is not a duplicate. The searches are finite, not an exhaustive
guarantee.
- [x] This concerns RocketMQ Studio's native alert collection/validation,
not a broker defect or a usage question.
- [x] The exact source revision and reproduction limits are stated below.
### Studio Version
`rocketmq-studio@127c47b06a268cc74224d5f34c56ec7c36ac0d55`.
Four critical, unmodified production classes were freshly compiled from the
exact Git blobs for a local diagnostic. Supporting DTO/dependency classes came
from an existing local build; this was not a fresh full application build.
### Runtime Environment
Windows, JDK 21.0.12+8, local Java process. No Studio deployment, MySQL,
browser, cloud account or live RocketMQ connection was used. This report does
not claim an HTTP reproduction or a missed production alert.
### Connected RocketMQ Cluster
None. `DLQProvider` and `InstanceRepository` were controlled in-memory Java
proxies. The real `ApacheRocketMqDlqMetricsCollector`, `NativeAlertRulePolicy`,
`NativeAlertRuleScopeMatcher`, `NativeAlertRuleTestService` and
`AlertRuleEvaluator` executed.
### Describe the Bug
A native BUSINESS rule for `dlq.message.count` can specify a concrete
`clusterName` or `brokerName` and pass `NativeAlertRulePolicy.validate`.
However, `ApacheRocketMqDlqMetricsCollector` constructs its samples with
`clusterId=null` and only a `consumerGroup` label.
`NativeAlertRuleScopeMatcher` applies concrete cluster/Broker selectors as
exact matches, so the rule trial discards every collected sample. The same
controlled provider observation is returned when the selector is absent or `*`.
Here `brokerName` refers to a **Broker**, not a Proxy. The demonstrated
entry point is a programmatically constructed rule/trial, not an ordinary UI
click path. The HTTP controller, persistence and scheduled event/notification
lifecycle were not exercised.
### Steps to Reproduce
1. Supply an Apache `InstanceVO` named `study-instance` through a controlled
`InstanceRepository.findByIdentifier`.
2. Have `DLQProvider.listDLQGroups("study-instance")` return one
`DLQGroupVO`: `groupName=orders`, `statsAvailable=true`, `messageCount=12`.
3. Construct the real `ApacheRocketMqDlqMetricsCollector` with that provider
and pass it as the business collector to the real `NativeAlertRuleTestService`,
with a real `AlertRuleEvaluator`.
4. Construct an enabled rule with `domain=BUSINESS`,
`instanceId=study-instance`, `metric=dlq.message.count`, `operator=>`,
`threshold=1`, `consecutiveSamples=1`, `duration=0s`. The zero-duration window
avoids snapshot history.
5. Call `NativeAlertRulePolicy.validate(rule)` and
`NativeAlertRuleTestService.test(rule)` with each scope variation below. For
the concrete cluster/Broker cases, also set `consumerGroup=orders`.
### What Did You Expect to See?
Do not silently accept a concrete dimension that the selected native
collector cannot supply. Either provide that dimension from authoritative
observations, or reject the unsupported selector with an actionable validation
error.
Ignoring a concrete selector to make the rule fire would widen its
configured scope and is not an acceptable fix.
### What Did You See Instead?
| Rule scope | Policy | Trial samples | Threshold condition |
| --- | --- | ---: | --- |
| No selectors | Accepted | 1 | `true` |
| `clusterName=*`, `brokerName=*`, `consumerGroup=orders` | Accepted | 1 |
`true` |
| `clusterName=cluster-a`, `consumerGroup=orders` | Accepted | 0 | Not
evaluated |
| `brokerName=broker-a`, `consumerGroup=orders` | Accepted | 0 | Not
evaluated |
| `consumerGroup=orders` | Accepted | 1 | `true` |
| `consumerGroup=payments` | Accepted | 0 | Not evaluated; expected negative
control |
These are six assertion-based observations of existing behavior, not JUnit
regression tests or a product-fix pass. Every trial collected through the
controlled provider; seven provider reads include an initial inspection
confirming an AVAILABLE sample with value 12. There were no network calls or
production-source modifications.
### Design Decision Before a PR
Should native DLQ rules reject concrete `clusterName`/`brokerName` until
those dimensions are observable, or should the provider/collector contract be
extended with authoritative dimensional data?
- Rejection needs a policy for existing stored rules and consistent handling
across save/import/trial paths.
- Supporting the dimensions needs correct multi-cluster/Broker attribution
and compatibility consideration; a guessed label is insufficient.
Neither change has been implemented pending direction.
### Additional Context
Relevant source at the selected revision:
-
[ApacheRocketMqDlqMetricsCollector.java](https://github.com/apache/rocketmq-dashboard/blob/127c47b06a268cc74224d5f34c56ec7c36ac0d55/server/src/main/java/org/apache/rocketmq/studio/cluster/metrics/collectors/ApacheRocketMqDlqMetricsCollector.java)
-
[NativeAlertRulePolicy.java](https://github.com/apache/rocketmq-dashboard/blob/127c47b06a268cc74224d5f34c56ec7c36ac0d55/server/src/main/java/org/apache/rocketmq/studio/ops/alert/NativeAlertRulePolicy.java)
-
[NativeAlertRuleScopeMatcher.java](https://github.com/apache/rocketmq-dashboard/blob/127c47b06a268cc74224d5f34c56ec7c36ac0d55/server/src/main/java/org/apache/rocketmq/studio/ops/alert/NativeAlertRuleScopeMatcher.java)
-
[NativeAlertRuleTestService.java](https://github.com/apache/rocketmq-dashboard/blob/127c47b06a268cc74224d5f34c56ec7c36ac0d55/server/src/main/java/org/apache/rocketmq/studio/ops/alert/NativeAlertRuleTestService.java)
Related merged #3989 concerns Prometheus export labels/profile mappings,
rather than this native collector/policy/trial mismatch. Closed #982 concerns
carrying the selected instance through runtime operations, not validating
optional native-alert dimensions. Neither is represented as my work.
AI assistance was used for code inspection and the local diagnostic. Earlier
harness failures (record-accessor compilation, class loading with a Unicode
output path, and Windows-path escaping) were retained; the final isolated
ASCII-path run freshly compiled the four critical classes and reproduced the
matrix above. No full backend build, packaging, live-broker/HTTP/MySQL test,
official CI result or implemented fix is claimed for this candidate. No raw
logs, diagnostic binaries, credentials or private combined patch are attached.
### Are You Willing to Submit a Pull Request?
Willing to prepare one focused, tested change after the selector policy is
agreed. This issue requests design direction; it does not submit code or sign a
contributor agreement.
--
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]