Skip to content

Wire the OTel manager's RegisterAction method to the extension satisfying the new ActionExtension interface#51872

Open
cmacknz wants to merge 6 commits into
elastic:mainfrom
cmacknz:cmacknz/fix-osquery-live-actions
Open

Wire the OTel manager's RegisterAction method to the extension satisfying the new ActionExtension interface#51872
cmacknz wants to merge 6 commits into
elastic:mainfrom
cmacknz:cmacknz/fix-osquery-live-actions

Conversation

@cmacknz

@cmacknz cmacknz commented Jul 10, 2026

Copy link
Copy Markdown
Member

This is the companion PR to elastic/elastic-agent#15459, which augments our elasticdiagnostics collector extension to route Fleet actions to beat receivers to allow osquerybeat to process live query actions successfully. That PR implements the ActionExtension interface in the Elastic diagnostics extension (out of convenience since it has everything we need) and is already wired into the supervisor collector by default.

Proposed commit message

Implement the OTel manager's RegisterAction and UnregisterAction methods by connecting them to the extension implementing he new ActionExtension interface. This allows Beat receivers to handle Fleet actions received by Elastic Agent for parity with the control protocol variant of the same feature when the Beat runs in its own process.

How to test this PR locally

This is best tested together as part of elastic/elastic-agent#15459, which includes an update to the TestOsqueryManager integration test proving that both scheduled and live query actions complete successfully.

cmacknz added 5 commits July 8, 2026 15:33
OtelManager.RegisterAction/UnregisterAction were no-op stubs, so beats
running as beats-receivers under the OTel runtime (e.g. osquerybeat)
silently dropped Fleet actions such as osquery live queries. Add
ActionExtension/WithActionExtension interfaces mirroring the existing
diagnostics extension pattern, forward RegisterAction/UnregisterAction
to a registered extension, and wire discovery of that extension into
BeatReceiver.Start alongside the existing diagnostics extension lookup.

Part of the fix for elastic/elastic-agent#15410.
ActionExtension.RegisterActionHandler now returns an error, so a beat
whose action registration is rejected as ambiguous (multiple per-stream
receivers registering an action for the same elastic-agent component)
gets an immediate, visible signal in its own logs via OtelManager, not
only when Fleet later dispatches an action and hits the conflict.
- Drop the now-redundant logger != nil guard in OtelManager.RegisterAction:
  NewOtelManager always supplies a real logger, so give the two tests that
  construct OtelManager directly a logp.NewNopLogger() instead.
- Use logptest.NewTestingLoggerWithObserver, the repo's existing helper for
  asserting on logged output, instead of hand-wiring a zap observer core.
RegisterAction now logs instead of silently no-opping when no action
extension is set (a prior manual edit), but the existing test's comment
and assertion still described and only checked for the old silent-no-op
behavior. Split it out into its own test that verifies the log line.
@cmacknz cmacknz self-assigned this Jul 10, 2026
@cmacknz cmacknz requested a review from a team as a code owner July 10, 2026 20:31
@cmacknz cmacknz requested review from leehinman and orestisfl July 10, 2026 20:31
@cmacknz cmacknz added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team skip-changelog backport-9.5 labels Jul 10, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@botelastic botelastic Bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • /test : Run the Buildkite pipeline.

@cmacknz cmacknz enabled auto-merge (squash) July 10, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-9.5 skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant