feat(asap-precompute-go): HttpPollChannel + OpAmpChannel (Phase 2 step 2.10) - #223
Merged
Merged
Conversation
…p 2.10) - HttpPollChannel: ETag-aware HTTP polling with bearer-token rotation, configurable Ack endpoint, race-tested concurrency. - OpAmpChannel: interface-satisfying stub; full OpAMP integration deferred to Phase 5 per ADR-0003. - httptest-driven coverage for ETag/304, errors, token rotation, cancellation. 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
Lands the two concrete
ControlChannelimplementations introduced as a trait in #219, completing Phase 2 step 2.10 of the precompute-runtime extraction. The interface itself only earns its keep when at least one real impl exists, so HTTP-poll and the OpAMP stub land together.GETagainst a configurable URL, JSON body decoded intoprecompute.PrecomputeConfigSet, optionalPOSTto anAckURLfor plan-version receipts. Bearer tokens are read from disk on every request so credential rotation does not require a runtime restart. Errors are stashed onLastErr()(the trait is errorless by design — adapters should never crash a runtime over a transient control-plane hiccup).ServerEndpointat construction, logs a once-per-instance warn fromPoll, debug-logs eachAck, returnsnilfromClose. Real OpAMP wiring (github.com/open-telemetry/opamp-go/client) is deferred to Phase 5 per ADR-0003; landing it now would force a transitive dep into Phase 2 for no functional gain.Wire format
The HTTP body is the standard
encoding/jsonmarshalling ofprecompute.PrecomputeConfigSet. No json tags exist on the struct yet, so field names follow Go-export casing (Version,Configs,AggID, …). Plan freshness is tracked via the HTTPETagheader: the first 200 stores the tag; subsequent polls send it back asIf-None-Matchand treat 304 as no-change.AckPOSTs{\"plan_version\": N}toAckURL(no-op when empty). Documented in thehttp_poll.gopackage comment so future schema work has a stable starting point.Test plan
go build ./...cleango vet ./...cleango test ./controlchannel/...— all greengo test -race ./controlchannel/...— race detector cleanhttptest-driven cases:Pollreturns nil,LastErrreports statusCloseon another goroutineAckURLPOSTs{\"plan_version\": N}; emptyAckURLis a no-opCloseis idempotent; subsequent Poll/Ack recordErrChannelClosedPollreturns nil; once-per-instance warn does not repeat;Ack/Close/idempotent-Closeno-ops; trait satisfaction checkNotes
ControlChannelinterface is unchanged. Both impls are additive.testingstyle.opentelemetry-collector/opentelemetry-gois intentionally not committed.🤖 Generated with Claude Code