[#1664] Make service builder log origins lazy #1877
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 436 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.364
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1877"
general
weight: 0.35
Nawazz-ish
Notes for Reviewer
Follow up to #1664 and the discussion on #1859. This is only the "stop doing pointless work"
half - it does not touch the size question, which is what I understood you have ideas about
and what we said we would discuss at the meetup.
The logging path is already lazy.
__internal_print_log_msgchecks the level before touchingthe logger and takes
core::fmt::Arguments, andwarn!(from x, ...)passesformat_args!,so nothing is formatted when a message is filtered out. But these call sites build a
Stringat function entry, before any of the
ifs:For a service builder that
Debugis 6493 characters, and it is paid on the success path withlogging disabled.
warn!(from self, ...)is already what 224 other call sites do, so this justmakes two of the exceptions match.
Two sites only, both on the service creation path. In
BuilderWithServiceType::openthereceiver is
&selfso it is a straight swap. Inadjust_configuration_to_meaningful_valuesthe
&mutborrow throughsettingsspans all fivewarn!calls, so each check now readsimmutably via the existing
publish_subscribe()accessor, logs, then mutates.No behaviour change other than the log text, which actually gets slightly cleaner: the origin
was being formatted twice (call site builds a
String, the macro then applies{:?}to it),which added 58 backslash escapes. That goes to 0.
Measured, 2000 publish-subscribe create-and-destroy cycles, log level
Fatalso nothing isever emitted, 7 runs, median:
| | before | after | saving |
| --- | --- | --- | --- |
| aarch64 macOS | 825.6 us | 759.9 us | 66 us |
| x86_64 Linux (m5.metal) | 5.887 ms | 5.748 ms | 139 us |
Worth being explicit that this is not a throughput or latency win - none of these sites is
on the send or receive path. It is startup and service creation work, and the percentage it
represents varies a lot with the storage under the temp directory (8.0% on the Mac's local SSD,
2.4% on the Linux box's EBS volume), so the absolute number is the meaningful one.
I left the other 27 sites alone deliberately. 12 more could convert the same way but showed no
measurable benefit, and the remaining 15 consume
self, sofrom selfdoes not compile thereat all. Those are better handled by whatever comes out of the size discussion.
Checked with
cargo fmt,cargo clippyandcargo test --workspaceon aarch64 macOS - 534publish-subscribe tests pass. The one clippy warning in
iceoryx2-bb-posixis on main too.Pre-Review Checklist for the PR Author
[x] Add sensible notes for the reviewer
[x] PR title is short, expressive and meaningful
[ ] Consider switching the PR to a draft (
Convert to draft)[x] Relevant issues are linked in the References section
[x] Branch follows the naming format (
iox2-1664-make-log-origins-lazy)[x] Commits messages are according to commit message guidelines
[x] Commit messages have the issue ID (
[#1664])[ ] Tests follow best practice for testing guidelines - no new tests, existing coverage
exercises these paths and the change has no behavioural effect
References
Relates to #1664