Wire the OTel manager's RegisterAction method to the extension satisfying the new ActionExtension interface#51872
Open
cmacknz wants to merge 6 commits into
Open
Conversation
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.
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Contributor
🤖 GitHub commentsJust comment with:
|
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.
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
TestOsqueryManagerintegration test proving that both scheduled and live query actions complete successfully.