Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: do not return empty confId even if agentConf has not recommendations (#3773)

Raj Kamal Singh838860da4036
diff --git a/pkg/query-service/agentConf/manager.go b/pkg/query-service/agentConf/manager.go
index a64c93d3fb..a919185d0d 100644
--- a/pkg/query-service/agentConf/manager.go
+++ b/pkg/query-service/agentConf/manager.go
@@ -2,6 +2,7 @@ package agentConf
import (
"context"
+ "crypto/sha256"
"fmt"
"strings"
"sync"
@@ -101,7 +102,7 @@ func (m *Manager) RecommendAgentConfig(currentConfYaml []byte) (
err error,
) {
recommendation := currentConfYaml
- settingVersions := []string{}
+ settingVersionsUsed := []string{}
for _, feature := range m.agentFeatures {
featureType := ElementTypeDef(feature.AgentFeatureType())
@@ -124,7 +125,7 @@ func (m *Manager) RecommendAgentConfig(currentConfYaml []byte) (
}
recommendation = updatedConf
configId := fmt.Sprintf("%s:%d", featureType, latestConfig.Version)
- settingVersions = append(settingVersions, configId)
+ settingVersionsUsed = append(settingVersionsUsed, configId)
m.updateDeployStatus(
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
}