elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
127 stars 136 forks source link

[windows] move service startup to beginning of run function #4971

Open leehinman opened 3 months ago

leehinman commented 3 months ago

Currently elastic-agent does several things before it communicates with the Windows Service Manager and registers itself and reports as running.

https://github.com/elastic/elastic-agent/blob/81e112dfb6202d24a0b2a8d73067b091c3647cf0/internal/pkg/agent/cmd/run.go#L143

This can cause problems because the service manager has a very short timeout between when it starts a process and expects that process to communicate that it is in StartPending state. For Windows we need to move this as close as possible to the start of the run function.

elasticmachine commented 3 months ago

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