mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 19:35:52 +08:00
chore: do not return empty confId even if agentConf has not recommendations (#3773)
This commit is contained in:
parent
6b2427f1c2
commit
838860da40
@ -2,6 +2,7 @@ package agentConf
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -101,7 +102,7 @@ func (m *Manager) RecommendAgentConfig(currentConfYaml []byte) (
|
|||||||
err error,
|
err error,
|
||||||
) {
|
) {
|
||||||
recommendation := currentConfYaml
|
recommendation := currentConfYaml
|
||||||
settingVersions := []string{}
|
settingVersionsUsed := []string{}
|
||||||
|
|
||||||
for _, feature := range m.agentFeatures {
|
for _, feature := range m.agentFeatures {
|
||||||
featureType := ElementTypeDef(feature.AgentFeatureType())
|
featureType := ElementTypeDef(feature.AgentFeatureType())
|
||||||
@ -124,7 +125,7 @@ func (m *Manager) RecommendAgentConfig(currentConfYaml []byte) (
|
|||||||
}
|
}
|
||||||
recommendation = updatedConf
|
recommendation = updatedConf
|
||||||
configId := fmt.Sprintf("%s:%d", featureType, latestConfig.Version)
|
configId := fmt.Sprintf("%s:%d", featureType, latestConfig.Version)
|
||||||
settingVersions = append(settingVersions, configId)
|
settingVersionsUsed = append(settingVersionsUsed, configId)
|
||||||
|
|
||||||
m.updateDeployStatus(
|
m.updateDeployStatus(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
@ -138,7 +139,16 @@ func (m *Manager) RecommendAgentConfig(currentConfYaml []byte) (
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configId = strings.Join(settingVersions, ",")
|
if len(settingVersionsUsed) > 0 {
|
||||||
|
configId = strings.Join(settingVersionsUsed, ",")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Do not return an empty configId even if no recommendations were made
|
||||||
|
hash := sha256.New()
|
||||||
|
hash.Write(recommendation)
|
||||||
|
configId = string(hash.Sum(nil))
|
||||||
|
}
|
||||||
|
|
||||||
return recommendation, configId, nil
|
return recommendation, configId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user