Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart desktop process on systray errors #1835

Merged
merged 13 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ee/agent/flags/flag_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,16 @@ func (fc *FlagController) LauncherWatchdogEnabled() bool {
).get(fc.getControlServerValue(keys.LauncherWatchdogEnabled))
}

func (fc *FlagController) SetSystrayRestartEnabled(enabled bool) error {
return fc.setControlServerValue(keys.SystrayRestartEnabled, boolToBytes(enabled))
}

func (fc *FlagController) SystrayRestartEnabled() bool {
return NewBoolFlagValue(
WithDefaultBool(false),
).get(fc.getControlServerValue(keys.SystrayRestartEnabled))
}

func (fc *FlagController) SetTraceSamplingRate(rate float64) error {
return fc.setControlServerValue(keys.TraceSamplingRate, float64ToBytes(rate))
}
Expand Down
5 changes: 3 additions & 2 deletions ee/agent/flags/keys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type FlagKey string

// When adding a new FlagKey:
// 1. Define the FlagKey identifier, and the string key value it corresponds to, in the block below
// 2. Add a getter and setter to the Flags interface (flags.go)
// 3. Implement the getter and setter in the FlagController, providing defaults, limits, and overrides
// 2. Add a getter and setter to the Flags interface (ee/agent/types/flags.go)
// 3. Implement the getter and setter in the FlagController (ee/agent/flags/flag_controller.go), providing defaults, limits, and overrides
// 4. Implement tests for any new APIs, sanitizers, limits, overrides.
// 5. Update mocks -- in ee/agent/types, run `mockery --name Knapsack` and `mockery --name Flags`.
const (
Expand Down Expand Up @@ -56,6 +56,7 @@ const (
InModernStandby FlagKey = "in_modern_standby"
LocalDevelopmentPath FlagKey = "localdev_path"
LauncherWatchdogEnabled FlagKey = "launcher_watchdog_enabled" // note that this will only impact windows deployments for now
SystrayRestartEnabled FlagKey = "systray_restart_enabled"
)

func (key FlagKey) String() string {
Expand Down
4 changes: 4 additions & 0 deletions ee/agent/types/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,8 @@ type Flags interface {
// LauncherWatchdogEnabled controls whether launcher installs/runs, or stops/removes the launcher watchdog service
SetLauncherWatchdogEnabled(enabled bool) error
LauncherWatchdogEnabled() bool

// SystrayRestartEnabled controls whether launcher's desktop runner will restart systray on error
SetSystrayRestartEnabled(enabled bool) error
SystrayRestartEnabled() bool
}
Loading
Loading