refactor(emit): re-target agent OTLP export from gateway:4317 → backend:4317 - #243
Merged
Merged
Conversation
…nd:4317
The deployment is collapsing the data path from
agent → gateway → asapquery-backend
to
agent → asapquery-backend
because asapquery-backend's `--enable-otel-ingest` already accepts
sketch data points and merges them per-aggregation_id via its precompute
engine accumulators (DDSketchAccumulator / HLLAccumulator / etc.) — no
middle-tier OTel gateway merge processor is required.
Functional changes:
- `ThreeStageEmitter::emit_per_stage` (emitter.rs:379): default
`EdgeStageConfig.exporter_target` flips from `Stage(StageId::Gateway)`
to `Stage(StageId::Backend)`. Comment added explaining the rationale.
- All 4 edge-emit call sites of `build_otlp_exporter` /
`resolve_export_endpoint` flip `default_host` from `"gateway"` to
`"backend"`:
* `emit_edge_yaml` (stage_config.rs:231)
* `emit_edge_yaml_5sketch_routing` variant (stage_config.rs:966)
* OTAP edge emit, Modes 1 and 2 (otap.rs:191, 205)
* Telegraf edge emit, Modes 1 and 2 (telegraf.rs:90, 95)
- `emit_gateway_yaml` (stage_config.rs:461) unchanged — the gateway's
own OTLP exporter still targets `backend:4317` (correct).
Code kept-but-unused:
- `emit_gateway_yaml` + `StageConfig::Gateway` + `AgentRole::Gateway`
push remain in source. They no longer reach any subscriber in the
default deployment but are preserved per the "keep gateway impl in
source" intent. Topologies that re-introduce a middle tier can flip
EdgeStageConfig.exporter_target back to Stage(Gateway) post-emit.
Test updates:
- The 3 assertions that the agent YAML/TOML contains `gateway:4317` flip
to assert `backend:4317`:
* `stage_config.rs:1509-1513` (OTel agent yaml)
* `otap.rs:461-464` (OTAP agent yaml)
* `telegraf.rs:367-370, 399-402` (Telegraf agent toml)
- Doc-comment at `stage_config.rs:1196-1199` and the inline rationale
at `stage_config.rs:228` updated.
Build: clean. 686 lib tests + 27 binary tests pass.
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
Pre-flight for the upcoming ASAPCollector deployment PR that collapses the data path from
agent → gateway → asapquery-backendtoagent → asapquery-backend.Why this works: asapquery-backend's
--enable-otel-ingestalready accepts*SketchDataPoints and routes them through the precompute engine's accumulators (DDSketchAccumulator / HLLAccumulator / etc.) — these merge per-aggregation_id across all incoming agents server-side. No middle-tier OTel gateway merge processor is needed.Functional changes
ThreeStageEmitter::emit_per_stage— defaultEdgeStageConfig.exporter_targetflips fromStage(StageId::Gateway)→Stage(StageId::Backend).build_otlp_exporter/resolve_export_endpointflipdefault_hostfrom"gateway"→"backend":emit_edge_yaml(stage_config.rs:231)emit_edge_yaml_5sketch_routingvariant (stage_config.rs:966)emit_gateway_yamlunchanged — the gateway's own OTLP exporter still targetsbackend:4317(correct, when a deployment does run a gateway).Kept-in-source per ”keep gateway impl in repos” intent
emit_gateway_yaml,StageConfig::Gateway,AgentRole::Gatewaypush — all preserved. They no longer reach any subscriber in the default deployment, but topologies re-introducing a middle tier can flipEdgeStageConfig.exporter_targetback toStage(Gateway)post-emit.Test plan
cargo checkclean (only pre-existing warnings)cargo test --lib: 686 passed; 0 failedcargo test --tests --bins: 27 passed; 0 failedgateway:4317flip to assertbackend:4317.🤖 Generated with Claude Code