Skip to content

feat: add opamp controller extension#3410

Open
albertlockett wants to merge 17 commits into
open-telemetry:mainfrom
albertlockett:albert/3387-part1
Open

feat: add opamp controller extension#3410
albertlockett wants to merge 17 commits into
open-telemetry:mainfrom
albertlockett:albert/3387-part1

Conversation

@albertlockett

@albertlockett albertlockett commented Jul 3, 2026

Copy link
Copy Markdown
Member

Change Summary

Adds initial implementation of OpAMP Agent Controller Extension.

Design doc can be found in #3388

Adds:

  • controller extension
  • OpAMP proto definitions & prost generated structs

Currently only works with websocket.

Followups will need to include:

  • plain HTTP transport (plain meaning traditional HTTP request/response, not necessarily plaintext)
  • mTLS
  • connection setting management (this is ignored)
  • metrics collection

Currently this lives in the controller crate. I wasn't sure where was the right place for this, and hesitated between controller or core-nodes. Happy to move if anyone has feelings/suggestions

What issue does this PR close?

How are these changes tested?

Are there any user-facing changes?

Changelog

  • Added a .chloggen/*.yaml entry
  • This PR is a chore (indicated in title)
  • This is a documentation-only PR.

@github-actions github-actions Bot added lang:rust Pull requests that update Rust code area:engine Internal engine features labels Jul 3, 2026
@albertlockett albertlockett requested a review from Copilot July 3, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial Rust implementation of an OpAMP Agent Controller Extension for the OTAP Dataflow engine, enabling remote engine config updates and status reporting over WebSocket (with future transport/security follow-ups noted in the PR description).

Changes:

  • Introduces a new opamp controller extension module with config validation, WebSocket session loop, and status/config exchange logic.
  • Adds OpAMP protobuf generation and commits the generated Rust bindings, backed by a new proto/opamp-spec submodule.
  • Adds test utilities and integration-style tests (mock OpAMP WebSocket server) plus required Rust dependencies.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
rust/otap-dataflow/xtask/src/genproto.rs Extends proto generation to compile OpAMP protos into the controller extension’s proto module.
rust/otap-dataflow/crates/controller/src/lib.rs Exposes the new controller extension module publicly.
rust/otap-dataflow/crates/controller/src/extension.rs Introduces the controller extension module entry point (pub mod opamp).
rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Implements the OpAMP controller extension runtime (session state, message handling, reconciliation, tests).
rust/otap-dataflow/crates/controller/src/extension/opamp/config.rs Adds extension configuration types and endpoint/backoff validation.
rust/otap-dataflow/crates/controller/src/extension/opamp/consts.rs Defines component health status string constants used in OpAMP health reporting.
rust/otap-dataflow/crates/controller/src/extension/opamp/error.rs Defines error types for OpAMP config validation failures.
rust/otap-dataflow/crates/controller/src/extension/opamp/util.rs Adds an exponential backoff utility (with jitter) used for reconnect/retry behavior.
rust/otap-dataflow/crates/controller/src/extension/opamp/test/util.rs Adds a mock ControlPlane and mock OpAMP WebSocket server helpers for tests.
rust/otap-dataflow/crates/controller/src/extension/opamp/proto/mod.rs Adds module wiring for the generated OpAMP protobuf bindings.
rust/otap-dataflow/crates/controller/src/extension/opamp/proto/opamp.proto.v1.rs Adds generated Rust types for OpAMP protobuf messages.
rust/otap-dataflow/crates/controller/Cargo.toml Adds dependencies needed by the extension and its tests (WebSocket, prost, axum, etc.).
rust/otap-dataflow/Cargo.toml Updates workspace dependency versions/features for axum websockets and adds tungstenite-related crates.
rust/otap-dataflow/Cargo.lock Locks new dependency additions (including multiple tokio-tungstenite/tungstenite versions).
.gitmodules Adds proto/opamp-spec as a git submodule to source OpAMP protobuf definitions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/util.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs
Comment thread rust/otap-dataflow/Cargo.toml Outdated
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.04582% with 523 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.15%. Comparing base (1a3f044) to head (7f7a5c3).
⚠️ Report is 6 commits behind head on main.

❌ Your patch check has failed because the patch coverage (70.04%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3410      +/-   ##
==========================================
- Coverage   86.23%   86.15%   -0.09%     
==========================================
  Files         741      746       +5     
  Lines      292447   294595    +2148     
==========================================
+ Hits       252203   253819    +1616     
- Misses      39720    40252     +532     
  Partials      524      524              
Components Coverage Δ
otap-dataflow 87.19% <70.04%> (-0.11%) ⬇️
query_engine 89.58% <ø> (ø)
otel-arrow-go 52.45% <ø> (ø)
quiver 92.19% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/config.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/config.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/config.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
@albertlockett albertlockett marked this pull request as ready for review July 6, 2026 12:17
@albertlockett albertlockett requested a review from a team as a code owner July 6, 2026 12:17
@albertlockett albertlockett changed the title [WIP] feat: add opamp controller extension feat: add opamp controller extension Jul 6, 2026
@albertlockett albertlockett mentioned this pull request Jul 6, 2026
3 tasks
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
Comment thread rust/otap-dataflow/crates/controller/src/extension/opamp/mod.rs Outdated
albertlockett and others added 9 commits July 7, 2026 09:37
…README

- Frame WebSocket messages with the varint header required by the OpAMP
  spec, on both send and receive; previously bare protobuf bytes were
  sent, and no message from a conforming server could be decoded.
- Encode instance_uid in standard RFC 4122 byte order (into_bytes)
  instead of the little-endian mixed encoding (to_bytes_le).
- Advertise AcceptsRemoteConfig and AcceptsRestartCommand capabilities;
  without them a conforming server never offers config or commands.
- Accept ServerToAgent messages with an empty instance_uid, which the
  opamp-go server sends on server-initiated pushes.
- Add README.md with step-by-step instructions for testing against the
  opamp-go example server.

false
}
HandledMessageAction::Restart => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we advertise AcceptsRestartCommand, should this be wired to a real agent/process restart?

Phase::ExchangeMessages => {
tokio::select! {
_ = cancellation_token.cancelled() => {
try_send_close_message(&mut ws_sender, config.shutdown_timeout).await;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the WebSocket close frame. I think this still misses the OpAMP part though: before the close frame, the client should send an AgentToServer message with agent_disconnect set. Right now this only sends the WebSocket Close frame, so the server still does not receive the OpAMP disconnect message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry about that Lalit, you're right. I should have read your previous feedback more carefully!

This has been corrected here: 7f7a5c3


### 2. Configure and run the engine

Save as `opamp.yaml`:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets have a working minimal file in the configs directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:engine Internal engine features lang:rust Pull requests that update Rust code size/XL

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants