Skip to content

Commit

Permalink
enhance logs and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitsuji-M committed Dec 18, 2024
1 parent 8ae3790 commit 31e2990
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions comp/remote-config/rcclient/rcclientimpl/rcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ func (rc rcClient) start() {
}
}

// mrfUpdateCallback is the callback function for the AGENT_FAILOVER configs.
// It fetches all the configs targeting the agent and applies the failover settings
// using an OR strategy. In case of nil the value is not updated, for a false it does not update if
// the setting is already set to true.
func (rc rcClient) mrfUpdateCallback(updates map[string]state.RawConfig, applyStateCallback func(string, state.ApplyStatus)) {
// If the updates map is empty, we should unset the failover settings if they were set via RC previously
if len(updates) == 0 {
Expand Down Expand Up @@ -223,7 +227,7 @@ func (rc rcClient) mrfUpdateCallback(updates map[string]state.RawConfig, applySt
if enableMetrics != nil {
err := rc.applyMRFRuntimeSetting("multi_region_failover.failover_metrics", *enableMetrics, enableMetricsCfgPth, applyStateCallback)
if err != nil {
pkglog.Errorf("Multi-Region Failover update unmarshal failed: %s", err)
pkglog.Errorf("Multi-Region Failover failed to apply new metrics settings : %s", err)
applyStateCallback(enableMetricsCfgPth, state.ApplyStatus{
State: state.ApplyStateError,
Error: err.Error(),
Expand All @@ -241,7 +245,7 @@ func (rc rcClient) mrfUpdateCallback(updates map[string]state.RawConfig, applySt
if enableLogs != nil {
err := rc.applyMRFRuntimeSetting("multi_region_failover.failover_logs", *enableLogs, enableLogsCfgPth, applyStateCallback)
if err != nil {
pkglog.Errorf("Multi-Region Failover update unmarshal failed: %s", err)
pkglog.Errorf("Multi-Region Failover failed to apply new logs settings : %s", err)
applyStateCallback(enableMetricsCfgPth, state.ApplyStatus{
State: state.ApplyStateError,
Error: err.Error(),
Expand Down

0 comments on commit 31e2990

Please sign in to comment.