feat(examples): add key expression argument to z_pub_thr and z_sub_thr#2549
feat(examples): add key expression argument to z_pub_thr and z_sub_thr#2549kydos wants to merge 5 commits into
Conversation
Allow users to specify a custom key expression for the throughput examples via a CLI argument. This makes it possible to benchmark router throughput scaling across multiple instances using either shared or distinct key expressions without modifying the source. Closes eclipse-zenoh#2548
There was a problem hiding this comment.
Pull request overview
Adds a CLI argument to the throughput examples so users can choose the key expression at runtime, enabling benchmarking across multiple instances without editing source (addresses #2548).
Changes:
- Add
--key-expr(KeyExpr<'static>) argument toz_pub_thrandz_sub_thr(default:test/thr). - Add
--key-exprargument to the shared-memory throughput publisher example (z_pub_shm_thr) and plumb it throughparse_args().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| examples/examples/z_sub_thr.rs | Adds --key-expr and uses it for subscriber declaration; refactors arg parsing. |
| examples/examples/z_pub_thr.rs | Adds --key-expr and uses it for publisher declaration. |
| examples/examples/z_pub_shm_thr.rs | Adds --key-expr and passes it through parse_args() to publisher declaration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .background() | ||
| .wait() | ||
| .unwrap(); | ||
| .expect("Failed to open Zenoh session"); |
There was a problem hiding this comment.
The error message passed to expect() is misleading here: the failing operation is the subscriber declaration/background start, not opening the Zenoh session (which already happened above). Use an error message that reflects the actual failing call (e.g., declaring/starting the subscriber), or move the expect() to the zenoh::open(...) call.
| .expect("Failed to open Zenoh session"); | |
| .expect("Failed to declare/start Zenoh subscriber"); |
There was a problem hiding this comment.
@kydos Copilot is right here, but I would rather write "Failed to declare subscriber".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2549 +/- ##
==========================================
- Coverage 74.83% 74.82% -0.02%
==========================================
Files 399 399
Lines 59373 59373
==========================================
- Hits 44433 44426 -7
- Misses 14940 14947 +7 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
Allow users to specify a custom key expression for the throughput examples via a CLI argument. This makes it possible to benchmark router throughput scaling across multiple instances using either shared or distinct key expressions without modifying the source.
What does this PR do?
See above.
Why is this change needed?
Because otherwise it is not possible to run throughput test on a user specified key-expr.
Related Issues
Closes #2548
🏷️ Label-Based Checklist
Based on the labels applied to this PR, please complete these additional requirements:
Labels:
new feature🆕 New Feature Requirements
Since this PR adds a new feature:
Consider: Can this feature be split into smaller, incremental PRs?
Instructions:
- [ ]to- [x])This checklist updates automatically when labels change, but preserves your checked boxes.