chore(core): clean up a bunch of code smells around supervisable worker implementations - #1860
Conversation
Binary Size Analysis (Agent Data Plane)Baseline: 0a909bd · Comparison: 6de0a10 · diff ✅ Binary size difference within thresholdChanges by Module
Detailed Symbol Changes |
There was a problem hiding this comment.
Pull request overview
This PR is a refactor/cleanup across several Supervisable worker implementations and async loops, primarily standardizing pin! usage and improving shutdown responsiveness/legibility in select! blocks.
Changes:
- Replace
tokio::pin!fully-qualified macro usage with importedpin!, and remove pinning where unnecessary. - Reorder multiple
select!blocks to prioritize shutdown branches and simplify control flow. - Extract a couple of inline
select!loop bodies into standalone async functions for readability (notablydynamic_apiand resource telemetry).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/saluki-env/src/workload/collectors/cgroups.rs | Use imported pin! for the spawned blocking poller handle. |
| lib/saluki-core/src/topology/blueprint.rs | Import/use pin!; reorder select! branches to prioritize shutdown. |
| lib/saluki-core/src/observability/metrics/mod.rs | Remove unnecessary pinning; simplify select! shutdown vs flush. |
| lib/saluki-core/src/health/worker.rs | Add rationale/TODO comment around shutdown handling and receiver return ordering. |
| lib/saluki-components/src/transforms/aggregate/mod.rs | Import/use pin! for flush future. |
| lib/saluki-components/src/encoders/datadog/traces/mod.rs | Import/use pin! for flush timeout future. |
| lib/saluki-components/src/encoders/datadog/stats/mod.rs | Import/use pin! for flush timeout future. |
| lib/saluki-components/src/encoders/datadog/metrics/mod.rs | Import/use pin! for flush timeout future. |
| lib/saluki-components/src/encoders/buffered_incremental/mod.rs | Import/use pin! for flush timeout future. |
| lib/saluki-components/src/destinations/dsd_stats/mod.rs | Consolidate time imports and use imported pin! for collection_done. |
| lib/saluki-app/src/metrics/mod.rs | Reorder select! to prioritize shutdown. |
| lib/saluki-app/src/metrics/api.rs | Minor formatting/whitespace tidy after processing loop. |
| lib/saluki-app/src/logging/api.rs | Import/use pin! for timeout + shutdown futures in loop. |
| lib/saluki-app/src/dynamic_api.rs | Rework shutdown/error handling to be at the top-level select!; simplify route event loop. |
| lib/saluki-app/src/accounting.rs | Extract resource-group telemetry loop into standalone async function; swap to FastHashMap. |
| bin/correctness/panoramic/src/runner.rs | Import/use pin! for the test run future. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| loop { | ||
| ResourceGroupRegistry::global().visit_resource_groups(|group_name, stats| { | ||
| let group_metrics = match metrics.get_mut(group_name) { | ||
| Some(group_metrics) => group_metrics, | ||
| None => metrics | ||
| .entry(group_name.to_string()) | ||
| .or_insert_with(|| ResourceGroupMetrics::new(group_name)), | ||
| }; | ||
|
|
||
| group_metrics.update(stats); | ||
| }); | ||
|
|
||
| sleep(Duration::from_secs(1)).await; | ||
| } |
There was a problem hiding this comment.
I actually like the fact we do the initial emission earlier.
Suggestion denieddddd.
This comment has been minimized.
This comment has been minimized.
Regression Detector (Agent Data Plane)Run ID: Optimization Goals: ✅ No significant changes detectedFine details of change detection per experiment (35)Experiments configured
Bounds Checks: ✅ Passed (5)
ExplanationA change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression ( |
f9fc6c3 to
623626e
Compare
623626e to
a80937c
Compare
webern
left a comment
There was a problem hiding this comment.
Looks good, and AI says "I don't see any threading correctness issues that need to be raised." 👍
cdc8126 to
6e7c11b
Compare
…er implementations
6e7c11b to
6de0a10
Compare

Summary
Classic cleanup PR.
In no particular order:
tokio::pin!pin!where we don't need worry about taking mutable borrows to get around "value moved here" issuesselect!blocks that race against shutdown to have the shutdown branch at the top ("do simple things first" principle)select!block just to keep things tidierChange Type
How did you test this PR?
Existing tests.
References
DADP-2