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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
fix: only latest agent config versions can have a pending deployment (#3836)
Raj Kamal Singh658a9cc11bc3
diff --git a/pkg/query-service/agentConf/db.go b/pkg/query-service/agentConf/db.goindex afb59123f4..3369dbe23f 100644--- a/pkg/query-service/agentConf/db.go+++ b/pkg/query-service/agentConf/db.go@@ -12,6 +12,7 @@ import ("go.signoz.io/signoz/pkg/query-service/agentConf/sqlite""go.signoz.io/signoz/pkg/query-service/model""go.uber.org/zap"+ "golang.org/x/exp/slices")func init() {@@ -61,6 +62,13 @@ func (r *Repo) GetConfigHistory(return nil, model.InternalError(err)}+ incompleteStatuses := []DeployStatus{DeployInitiated, Deploying}+ for idx := 1; idx < len(c); idx++ {+ if slices.Contains(incompleteStatuses, c[idx].DeployStatus) {+ c[idx].DeployStatus = DeployStatusUnknown+ }+ }+return c, nil}diff --git a/pkg/query-service/agentConf/version.go b/pkg/query-service/agentConf/version.goindex c6b8c01ee4..13be5f7cd2 100644--- a/pkg/query-service/agentConf/version.go+++ b/pkg/query-service/agentConf/version.go@@ -18,11 +18,12 @@ const (type DeployStatus stringconst (- PendingDeploy DeployStatus = "DIRTY"- Deploying DeployStatus = "DEPLOYING"- Deployed DeployStatus = "DEPLOYED"- DeployInitiated DeployStatus = "IN_PROGRESS"- DeployFailed DeployStatus = "FAILED"+ PendingDeploy DeployStatus = "DIRTY"+ Deploying DeployStatus = "DEPLOYING"+ Deployed DeployStatus = "DEPLOYED"+ DeployInitiated DeployStatus = "IN_PROGRESS"+ DeployFailed DeployStatus = "FAILED"+ DeployStatusUnknown DeployStatus = "UNKNOWN")type ConfigVersion struct {diff --git a/pkg/query-service/tests/integration/logparsingpipeline_test.go b/pkg/query-service/tests/integration/logparsingpipeline_test.goindex 2e1b70c1db..1b370e7804 100644--- a/pkg/query-service/tests/integration/logparsingpipeline_test.go+++ b/pkg/query-service/tests/integration/logparsingpipeline_test.go@@ -172,6 +172,77 @@ func TestLogPipelinesLifecycle(t *testing.T) {)}+func TestLogPipelinesHistory(t *testing.T) {+ require := require.New(t)+ testbed := NewLogPipelinesTestBed(t)++ // Only the latest config version can be "IN_PROGRESS",+ // other incomplete deployments should have status "UNKNOWN"+ getPipelinesResp := testbed.GetPipelinesFromQS()+ require.Equal(0, len(getPipelinesResp.History))++ postablePipelines := logparsingpipeline.PostablePipelines{+ Pipelines: []logparsingpipeline.PostablePipeline{+ {+ OrderId: 1,+ Name: "pipeline1",+ Alias: "pipeline1",+ Enabled: true,+ Filter: &v3.FilterSet{+ Operator: "AND",+ Items: []v3.FilterItem{+ {+ Key: v3.AttributeKey{+ Key: "method",+ DataType: v3.AttributeKeyDataTypeString,+ Type: v3.AttributeKeyTypeTag,+ },+ Operator: "=",+ Value: "GET",+ },+ },+ },+ Config: []logparsingpipeline.PipelineOperator{+ {+ OrderId: 1,+ ID: "add",+ Type: "add",+ Field: "attributes.test",+ Value: "val",+ Enabled: true,+ Name: "test add",+ },+ },+ },+ },+ }++ testbed.PostPipelinesToQS(postablePipelines)+ getPipelinesResp = testbed.GetPipelinesFromQS()+ require.Equal(1, len(getPipelinesResp.History))+ require.Equal(agentConf.DeployInitiated, getPipelinesResp.History[0].DeployStatus)++ postablePipelines.Pipelines[0].Config = append(+ postablePipelines.Pipelines[0].Config,+ logparsingpipeline.PipelineOperator{+ OrderId: 2,+ ID: "remove",+ Type: "remove",+ Field: "attributes.test",+ Enabled: true,+ Name: "test remove",+ },+ )+ postablePipelines.Pipelines[0].Config[0].Output = "remove"++ testbed.PostPipelinesToQS(postablePipelines)+ getPipelinesResp = testbed.GetPipelinesFromQS()++ require.Equal(2, len(getPipelinesResp.History))+ require.Equal(agentConf.DeployInitiated, getPipelinesResp.History[0].DeployStatus)+ require.Equal(agentConf.DeployStatusUnknown, getPipelinesResp.History[1].DeployStatus)+}+func TestLogPipelinesValidation(t *testing.T) {validPipelineFilterSet := &v3.FilterSet{Operator: "AND",