SouthwestAsiaFloat opened a new pull request, #7542:
URL: https://github.com/apache/shenyu/pull/7542
### Motivation
Add rule-level canary routing to Divide. Upstream labels define Stable and
Canary pools, while request conditions and a configured percentage determine
the target partition. Metrics expose request outcomes, fallbacks, and latency
by partition.
### Changes
- Support upstream `labels` in Props, including Admin validation,
configuration synchronization, and gateway cache updates while preserving other
Props fields.
- Add Canary configuration to Divide rules, including request conditions,
traffic percentage, sticky key, partition labels, and empty-pool policies.
- Reuse existing condition matching and parameter extraction. Deterministic
bucketing based on the rule ID and sticky key keeps partition selection
consistent for the same configuration and key.
- Reuse existing load balancing and circuit-breaker filtering within the
selected partition. HTTP retries retain that partition and use refreshed
upstream candidates.
- Extend the existing Metrics plugin and Prometheus reporter with:
- `shenyu_canary_requests_total{selector,rule,partition,outcome}`
- `shenyu_canary_fallback_total{selector,rule,reason}`
- `shenyu_canary_decision_duration_seconds{selector,rule}`
- Add a `partition` label to the existing `shenyu_execute_latency_millis`
histogram. Record each external request outcome once, without counting internal
retries as additional requests.
- Add configuration, routing, retry, and metrics tests, along with
documentation covering metric semantics and PromQL examples.
### Compatibility and behavior
- Rules without Canary configuration retain their existing routing behavior.
Disabling an existing Canary configuration routes requests to Stable.
- Requests enter Stable when conditions do not match, the percentage is 0,
or a required sticky key is missing from the request.
- An empty Canary candidate pool falls back to Stable or rejects the request
according to configuration. An empty Stable candidate pool rejects the request.
- Existing health-check and legacy `gray` behavior is preserved. This change
does not add active failure detection when local health checks are disabled;
legacy routing may fall back to ordinary nodes when all gray nodes are
unavailable.
- Metrics do not include sticky keys, user IDs, request IDs, or sensitive
Header/Cookie values.
- Request latency retains the existing timing logic. The additional
partition label and updated histogram buckets require reviewing existing
dashboard queries. Quantiles should not combine incompatible old and new bucket
layouts during rolling upgrades.
### Validation
- After merging upstream, 505 relevant tests across 43 test classes passed.
- Real Prometheus end-to-end validation passed, covering scraping, PromQL,
partition request counts, error rates, latency, fallbacks, rejections, and
retry deduplication.
- Completed the performance matrix for 10, 100, and 1,000 logical upstream
nodes across the original baseline, the current version without Canary
configuration, and the current version with Canary enabled, with three rounds
per combination.
- Host load varied substantially during performance testing. These results
are measurement records, not evidence of meeting performance targets or
establishing a performance regression.
- The full-repository `./mvnw clean install -Dmaven.javadoc.skip=true`
validation required by the PR template has not yet been completed.
### Detailed validation report
Report filename: `CANARY_PR_VALIDATION_REPORT_20261011.md`
The report includes the proposal’s functional acceptance matrix, relevant
regression tests after merging upstream, real Prometheus end-to-end validation,
and performance measurements across three modes.The performance practice
recorded might be inaccurate since there is a high load in my computer.
[CANARY_PR_VALIDATION_REPORT_20261011.md](https://github.com/user-attachments/files/33295520/CANARY_PR_VALIDATION_REPORT_20261011.md)
- [X] You have read the [contribution
guidelines](https://shenyu.apache.org/community/contributor-guide).
- [X] You submit test cases (unit or integration tests) that back your
changes.
- [X] Your local test passed `./mvnw clean install
-Dmaven.javadoc.skip=true`.
--
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]