Skip to content

Commit

Permalink
Feature-flag restarting systray
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Aug 29, 2024
1 parent 0c428c7 commit ea10836
Show file tree
Hide file tree
Showing 7 changed files with 941 additions and 9 deletions.
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

0 comments on commit ea10836

Please sign in to comment.