refactor(emit): retire legacy backend-collector emitter — target tier never existed - #241
Merged
Merged
Conversation
… never existed
`emit/backend.rs::generate_backend_collector_config` emitted OTel-
collector YAML for a "backend-role" merge-collector tier that was never
actually deployed in any ASAPCollector configuration. Its output keyed
processors as `{sketch}_merge` with a `{mode, group_by}` body — a shape
no ASAPCollector processor accepts (the real merge processors are
factory type `{sketch}merge` with `Config { MetricName string }`).
Anything that pushed this YAML via OpAMP `push_to_role(AgentRole::Backend)`
went to zero subscribers — and any future backend collector that *did*
register would receive a config it couldn't load.
The work this path nominally did — central sketch merging — has been
taken over by the typed L5: `StageId::Backend` routes through
`emit_backend_streaming_config_json`, which posts to asapquery-backend's
precompute engine over HTTP. That's the real merge path.
Removes:
- control_plane/src/emit/backend.rs (function + 3 tests)
- pub mod / re-export entry in emit/mod.rs (table updated to record retirement)
- Imports + 4 call sites:
- main.rs::handle_plan — per-plan OpAMP push
- main.rs::handle_rollback — rollback OpAMP push
- main.rs::handle_bootstrap_backend_config + its
/api/v1/collector-config/backend route (entire handler)
- replan.rs::Replanner — replan OpAMP push
- Stale doc-comment in emit/stage_config.rs referencing the retired emitter
Kept (out of scope for this PR):
- types::BackendCollectorConfig struct + CollectionPlan.backend_config
field — still populated by the optimizer and read by metrics_exposer
for Prometheus counters. Worth re-assessing in a follow-up.
- AgentRole::Backend enum variant — public OpAMP role surface; cheap to
leave available.
Build clean. All 687 lib tests + 27 binary tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
3 tasks
zzylol
added a commit
that referenced
this pull request
May 15, 2026
…gentCollectorConfig (#242) Now that the legacy backend-collector emitter is retired (#241), the `BackendCollectorConfig { merge_sketch_type, group_by }` struct on `CollectionPlan` has no real consumers — both fields are derivative of `AgentCollectorConfig`: - `merge_sketch_type` was always set to `agent_config.sketch_type.clone()` (literally — see the deleted `let backend_sketch = sketch_type.clone();` line in RulesPlanner, and the deleted `backend_config_matches_sketch_type` test that asserted the equality as an invariant). - `group_by` was always `agent_config.aggregate_by.clone()` when set, else `vec![]`. The shadow was a true field-by-field duplicate. Only one site read these fields: the `metrics_exposer` plan-id hash, which already includes `agent_config.sketch_type`. Replaced `backend_config.group_by` with `agent_config.aggregate_by` in the hash (option (b) from review) to preserve the "plan_id changes when grouping changes" observability semantic. Removes: - `pub struct BackendCollectorConfig` + the `pub backend_config` field - 8 initializer sites (store, replan, optimizer/{rules×2, cost test, cost/delta test, cost/mod test}, emit/asapquery_backend test, metrics_exposer test) - 3 mutation sites in the optimizer's sketch-type tuning loops (cost/mod ×2, pareto) - The redundant `backend_config_matches_sketch_type` test in rules/mod.rs - One import of `BackendCollectorConfig` in emit/asapquery_backend.rs Plan-id hash values shift on this release — they're opaque per-plan identifiers, so anyone alerting on specific values was already on shaky ground. The semantics (changes-on-replan, stable-on-refresh) are preserved. Build clean. 686 lib tests + 27 binary tests pass (1 less than before this PR — the deleted redundant-invariant test). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
emit/backend.rs::generate_backend_collector_config— it emitted OTel-collector YAML for a "backend-role" merge-collector tier that was never deployed in any ASAPCollector configuration. Its output keyed processors as{sketch}_mergewith a{mode, group_by}body — a shape no real ASAPCollector processor accepts (real merge processors are factory type{sketch}mergewithConfig { MetricName string }).handle_plan,handle_rollback, the/api/v1/collector-config/backendbootstrap handler, andReplanner) that all routed toAgentRole::Backend— which has zero subscribers in current deployment.StageId::Backendalready routes throughemit_backend_streaming_config_jsonto asapquery-backend's precompute engine over HTTP. That's the real merge path.What's NOT touched
Kept intentionally — these have separate consumers and warrant their own follow-up decision:
types::BackendCollectorConfig+CollectionPlan.backend_config— still populated by optimizer cost/rules and read bymetrics_exposerfor Prometheus counters.AgentRole::Backendenum variant — public OpAMP role surface, cheap to leave registered.Test plan
cargo checkclean (only pre-existing warnings)cargo test --lib: 687 passed; 0 failedcargo test --tests: 27 passed; 0 failedcargo test --bin control_plane: 27 passed; 0 failed🤖 Generated with Claude Code