feature: add detailed saga result reporting to benchmark cli#8042
feature: add detailed saga result reporting to benchmark cli#8042zihenzzz wants to merge 15 commits intoapache:2.xfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Enhances seata-benchmark-cli’s existing --mode SAGA benchmark path by adding SAGA end-state reporting (committed/compensated/etc.), CSV/report enrichment, and new CLI controls for state-machine shape selection and targeted/reproducible failure injection.
Changes:
- Add SAGA-specific outcome counters/rates to metrics, final report output, and CSV export.
- Introduce CLI parameters
--saga-shape,--saga-fail-step, and--saga-random-seed, wiring them into SAGA execution and reporting. - Update SAGA state-machine services to support step-targeted failure injection with optional seeded randomness.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/PaymentSagaService.java | Adds optional, step-gated failure injection with seeded randomness support. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/OrderSagaService.java | Adds optional, step-gated failure injection with seeded randomness support. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/InventorySagaService.java | Adds optional, step-gated failure injection with seeded randomness support. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/monitor/MetricsCollector.java | Includes mode/saga-shape and detailed SAGA outcome fields in final report + CSV. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java | Adds outcome counters/rates and introduces recordTransaction(status, latency) API. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/executor/WorkloadGenerator.java | Switches metric recording to status-based recordTransaction(...). |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/executor/SagaModeExecutor.java | Adds saga shape selection + step-targeted/seeded failure injection wiring into state-machine config. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/config/BenchmarkConfigLoader.java | Extends config merge to include saga-specific CLI parameters. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/config/BenchmarkConfig.java | Adds saga-specific config fields and validation for allowed values. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/BenchmarkRunner.java | Passes config into MetricsCollector for enriched reporting. |
| test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/BenchmarkApplication.java | Adds CLI options for saga shape/fail-step/random-seed and prints them in configuration. |
| test-suite/seata-benchmark-cli/README.md | Documents new SAGA options, examples, and richer report/CSV fields. |
| changes/zh-cn/2.x.md | Adds changelog entry for the benchmark SAGA enhancements. |
| changes/en-us/2.x.md | Adds changelog entry for the benchmark SAGA enhancements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/executor/SagaModeExecutor.java
Outdated
Show resolved
Hide resolved
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/executor/SagaModeExecutor.java
Outdated
Show resolved
Hide resolved
...ite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
Show resolved
Hide resolved
...ite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
Show resolved
Hide resolved
...ite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/config/BenchmarkConfig.java
Show resolved
Hide resolved
...e/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/monitor/MetricsCollector.java
Show resolved
Hide resolved
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/executor/SagaModeExecutor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/executor/WorkloadGenerator.java
Show resolved
Hide resolved
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/executor/SagaModeExecutor.java
Show resolved
Hide resolved
There are still two unfinished. |
…' into feature/saga-benchmark-reporting
|
@WangzJi If the benchmark needs to connect to the database, there will be a lot more configurations. Can't the current mock meet the requirements? |
WangzJi
left a comment
There was a problem hiding this comment.
The benchmark already uses Testcontainers for AT mode, it auto-starts a MySQL container without requiring any manual database configuration. If Saga mode needs DB-backed actions, we can follow the same approach.
Sorry, I made a copy mistake. What I want to say is that I have basically fixed this PR now, but there may be other issues. Please take a look |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
Outdated
Show resolved
Hide resolved
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/PaymentDbSagaService.java
Outdated
Show resolved
Hide resolved
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/PaymentDbSagaService.java
Outdated
Show resolved
Hide resolved
...eata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/InventoryDbSagaService.java
Outdated
Show resolved
Hide resolved
...eata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/InventoryDbSagaService.java
Outdated
Show resolved
Hide resolved
...uite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/OrderSagaService.java
Outdated
Show resolved
Hide resolved
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/InventorySagaService.java
Outdated
Show resolved
Hide resolved
.../seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/PaymentDbSagaService.java
Show resolved
Hide resolved
...te/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/OrderDbSagaService.java
Outdated
Show resolved
Hide resolved
...eata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/InventoryDbSagaService.java
Show resolved
Hide resolved
...ite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
Show resolved
Hide resolved
...eata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/InventoryDbSagaService.java
Outdated
Show resolved
Hide resolved
...eata-benchmark-cli/src/main/java/org/apache/seata/benchmark/saga/InventoryDbSagaService.java
Outdated
Show resolved
Hide resolved
Great work! If it's convenient for you, we can have a quick sync on DingTalk (iwongjian666) to align on the next steps. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #8042 +/- ##
============================================
- Coverage 72.11% 72.06% -0.05%
- Complexity 872 873 +1
============================================
Files 1319 1319
Lines 50479 50479
Branches 6018 6018
============================================
- Hits 36401 36377 -24
- Misses 11093 11117 +24
Partials 2985 2985 🚀 New features to boost your workflow:
|
Ⅰ. Describe what this PR did
This PR enhances the traditional
--mode SAGAbenchmark path inseata-benchmark-cliwithout introducing a new Saga mode.The current changes focus on two areas:
Improve Saga benchmark observability by exposing richer Saga-specific result categories in benchmark metrics, final report output, and CSV export.
The benchmark now reports detailed Saga end states such as
committed,compensated,execution failed,compensation failed, andunknown, instead of only showing a coarse success/failed summary.Add step-targeted Saga failure injection for the real state-machine-based SAGA benchmark path.
A new CLI parameter
--saga-fail-stepis added to restrict failure injection to a selected forward step (inventory,payment, ororder), while the actual failure ratio is still controlled by--rollback-percentage.Allow explicit selection of predefined Saga state machine shapes while preserving backward compatibility.
A new CLI parameter
--saga-shapeis added to select the Saga state machine shape explicitly (such assimpleororder). If it is not specified, the benchmark keeps the existing branches-based compatibility behavior. The selected Saga shape is also included in the final report and CSV export output.Add reproducible Saga failure injection support.
A new CLI parameter
--saga-random-seedis added so that Saga failure injection can be reproduced more consistently under the same benchmark configuration.Ⅱ. Does this pull request fix one issue?
fix #8039
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews