mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 20:19:13 +08:00
fix: opamp server: do not panic if config generation fails (#4307)
This commit is contained in:
parent
86ff865842
commit
fd9a502012
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -259,7 +258,7 @@ func (agent *Agent) processStatusUpdate(
|
|||||||
// If remote config is changed and different from what the Agent has then
|
// If remote config is changed and different from what the Agent has then
|
||||||
// send the new remote config to the Agent.
|
// send the new remote config to the Agent.
|
||||||
if configChanged ||
|
if configChanged ||
|
||||||
(agent.Status.RemoteConfigStatus != nil &&
|
(agent.Status.RemoteConfigStatus != nil && agent.remoteConfig != nil &&
|
||||||
!bytes.Equal(agent.Status.RemoteConfigStatus.LastRemoteConfigHash, agent.remoteConfig.ConfigHash)) {
|
!bytes.Equal(agent.Status.RemoteConfigStatus.LastRemoteConfigHash, agent.remoteConfig.ConfigHash)) {
|
||||||
// The new status resulted in a change in the config of the Agent or the Agent
|
// The new status resulted in a change in the config of the Agent or the Agent
|
||||||
// does not have this config (hash is different). Send the new config the Agent.
|
// does not have this config (hash is different). Send the new config the Agent.
|
||||||
@ -277,8 +276,8 @@ func (agent *Agent) processStatusUpdate(
|
|||||||
func (agent *Agent) updateRemoteConfig(configProvider AgentConfigProvider) bool {
|
func (agent *Agent) updateRemoteConfig(configProvider AgentConfigProvider) bool {
|
||||||
recommendedConfig, confId, err := configProvider.RecommendAgentConfig([]byte(agent.EffectiveConfig))
|
recommendedConfig, confId, err := configProvider.RecommendAgentConfig([]byte(agent.EffectiveConfig))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// The server must always recommend a config.
|
zap.S().Error("could not generate config recommendation for agent:", agent.ID, err)
|
||||||
panic(fmt.Errorf("could not generate config recommendation for agent %s: %w", agent.ID, err))
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := protobufs.AgentRemoteConfig{
|
cfg := protobufs.AgentRemoteConfig{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user