-
Notifications
You must be signed in to change notification settings - Fork 193
Open
Labels
Team:Elastic-Agent-Control-PlaneLabel for the Agent Control Plane teamLabel for the Agent Control Plane teamenhancementNew feature or requestNew feature or request
Description
The current action handling behaviour dispatches actions completely asynchrously from the checkin-loop:
elastic-agent/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go
Lines 161 to 176 in ab68480
case <-f.scheduler.WaitTick(): | |
f.log.Debug("FleetGateway calling Checkin API") | |
// Execute the checkin call and for any errors returned by the fleet-server API | |
// the function will retry to communicate with fleet-server with an exponential delay and some | |
// jitter to help better distribute the load from a fleet of agents. | |
resp, err := f.doExecute(ctx, requestBackoff) | |
if err != nil { | |
continue | |
} | |
actions := make([]fleetapi.Action, len(resp.Actions)) | |
copy(actions, resp.Actions) | |
if len(actions) > 0 { | |
f.actionCh <- actions | |
} |
After fleet checkin, the agent sends all actions through a channel to the dispatcher. They are executed concurrently with the checkin loop; the ticker by default has a 1s duration with up to 500ms jitter.
There is no guarantee that the POLICY_CHANGE action is executed before the next checkin.
We should adjust this to attempt to run a POLICY_CHANGE action before the next checkin is sent.
Metadata
Metadata
Assignees
Labels
Team:Elastic-Agent-Control-PlaneLabel for the Agent Control Plane teamLabel for the Agent Control Plane teamenhancementNew feature or requestNew feature or request