chore: use new uuid in pipelines (#7487)

This commit is contained in:
Nityananda Gohain 2025-03-31 16:45:00 +05:30 committed by GitHub
parent 459712d25c
commit 71d1dfe9bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 18 deletions

View File

@ -12,7 +12,7 @@ import (
"github.com/SigNoz/signoz/pkg/query-service/utils" "github.com/SigNoz/signoz/pkg/query-service/utils"
"github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types"
"github.com/SigNoz/signoz/pkg/types/pipelinetypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes"
"github.com/google/uuid" "github.com/SigNoz/signoz/pkg/valuer"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
) )
@ -271,8 +271,10 @@ func (m *Manager) GetPipelinesForInstalledIntegrations(
// since versioning while saving pipelines requires a new id for each version // since versioning while saving pipelines requires a new id for each version
// to avoid altering history when pipelines are edited/reordered etc // to avoid altering history when pipelines are edited/reordered etc
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
Alias: AliasForIntegrationPipeline(ii.Id, p.Alias), Alias: AliasForIntegrationPipeline(ii.Id, p.Alias),
ID: uuid.NewString(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: p.OrderID, OrderID: p.OrderID,
Enabled: p.Enabled, Enabled: p.Enabled,
Name: p.Name, Name: p.Name,

View File

@ -12,8 +12,10 @@ import (
"github.com/SigNoz/signoz/pkg/query-service/model" "github.com/SigNoz/signoz/pkg/query-service/model"
"github.com/SigNoz/signoz/pkg/query-service/utils" "github.com/SigNoz/signoz/pkg/query-service/utils"
"github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/sqlstore"
"github.com/SigNoz/signoz/pkg/types"
"github.com/SigNoz/signoz/pkg/types/authtypes" "github.com/SigNoz/signoz/pkg/types/authtypes"
"github.com/SigNoz/signoz/pkg/types/pipelinetypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes"
"github.com/SigNoz/signoz/pkg/valuer"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/pkg/errors" "github.com/pkg/errors"
"go.uber.org/zap" "go.uber.org/zap"
@ -82,7 +84,7 @@ func (ic *LogParsingPipelineController) ApplyPipelines(
// prepare config elements // prepare config elements
elements := make([]string, len(pipelines)) elements := make([]string, len(pipelines))
for i, p := range pipelines { for i, p := range pipelines {
elements[i] = p.ID elements[i] = p.ID.StringValue()
} }
// prepare config by calling gen func // prepare config by calling gen func
@ -110,7 +112,9 @@ func (ic *LogParsingPipelineController) ValidatePipelines(
for _, pp := range postedPipelines { for _, pp := range postedPipelines {
gettablePipelines = append(gettablePipelines, pipelinetypes.GettablePipeline{ gettablePipelines = append(gettablePipelines, pipelinetypes.GettablePipeline{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: pp.OrderID, OrderID: pp.OrderID,
Enabled: pp.Enabled, Enabled: pp.Enabled,
Name: pp.Name, Name: pp.Name,

View File

@ -11,7 +11,7 @@ import (
"github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types"
"github.com/SigNoz/signoz/pkg/types/authtypes" "github.com/SigNoz/signoz/pkg/types/authtypes"
"github.com/SigNoz/signoz/pkg/types/pipelinetypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes"
"github.com/google/uuid" "github.com/SigNoz/signoz/pkg/valuer"
"github.com/pkg/errors" "github.com/pkg/errors"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -60,8 +60,10 @@ func (r *Repo) insertPipeline(
insertRow := &pipelinetypes.GettablePipeline{ insertRow := &pipelinetypes.GettablePipeline{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
OrgID: orgID, OrgID: orgID,
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: postable.OrderID, OrderID: postable.OrderID,
Enabled: postable.Enabled, Enabled: postable.Enabled,
Name: postable.Name, Name: postable.Name,

View File

@ -10,8 +10,9 @@ import (
"github.com/SigNoz/signoz/pkg/query-service/model" "github.com/SigNoz/signoz/pkg/query-service/model"
v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3" v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3"
"github.com/SigNoz/signoz/pkg/query-service/utils" "github.com/SigNoz/signoz/pkg/query-service/utils"
"github.com/SigNoz/signoz/pkg/types"
"github.com/SigNoz/signoz/pkg/types/pipelinetypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes"
"github.com/google/uuid" "github.com/SigNoz/signoz/pkg/valuer"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/entry" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/entry"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -228,7 +229,9 @@ func TestNoCollectorErrorsFromProcessorsForMismatchedLogs(t *testing.T) {
makeTestPipeline := func(config []pipelinetypes.PipelineOperator) pipelinetypes.GettablePipeline { makeTestPipeline := func(config []pipelinetypes.PipelineOperator) pipelinetypes.GettablePipeline {
return pipelinetypes.GettablePipeline{ return pipelinetypes.GettablePipeline{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: 1, OrderID: 1,
Name: "pipeline1", Name: "pipeline1",
Alias: "pipeline1", Alias: "pipeline1",
@ -457,7 +460,9 @@ func TestResourceFiltersWork(t *testing.T) {
testPipeline := pipelinetypes.GettablePipeline{ testPipeline := pipelinetypes.GettablePipeline{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: 1, OrderID: 1,
Name: "pipeline1", Name: "pipeline1",
Alias: "pipeline1", Alias: "pipeline1",
@ -525,7 +530,9 @@ func TestPipelineFilterWithStringOpsShouldNotSpamWarningsIfAttributeIsMissing(t
} { } {
testPipeline := pipelinetypes.GettablePipeline{ testPipeline := pipelinetypes.GettablePipeline{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: 1, OrderID: 1,
Name: "pipeline1", Name: "pipeline1",
Alias: "pipeline1", Alias: "pipeline1",
@ -584,7 +591,9 @@ func TestAttributePathsContainingDollarDoNotBreakCollector(t *testing.T) {
testPipeline := pipelinetypes.GettablePipeline{ testPipeline := pipelinetypes.GettablePipeline{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: 1, OrderID: 1,
Name: "pipeline1", Name: "pipeline1",
Alias: "pipeline1", Alias: "pipeline1",
@ -645,7 +654,9 @@ func TestMembershipOpInProcessorFieldExpressions(t *testing.T) {
testPipeline := pipelinetypes.GettablePipeline{ testPipeline := pipelinetypes.GettablePipeline{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: 1, OrderID: 1,
Name: "pipeline1", Name: "pipeline1",
Alias: "pipeline1", Alias: "pipeline1",
@ -752,7 +763,9 @@ func TestContainsFilterIsCaseInsensitive(t *testing.T) {
testPipelines := []pipelinetypes.GettablePipeline{{ testPipelines := []pipelinetypes.GettablePipeline{{
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: 1, OrderID: 1,
Name: "pipeline1", Name: "pipeline1",
Alias: "pipeline1", Alias: "pipeline1",
@ -783,7 +796,9 @@ func TestContainsFilterIsCaseInsensitive(t *testing.T) {
}, },
}, { }, {
StoreablePipeline: pipelinetypes.StoreablePipeline{ StoreablePipeline: pipelinetypes.StoreablePipeline{
ID: uuid.New().String(), Identifiable: types.Identifiable{
ID: valuer.GenerateUUID(),
},
OrderID: 2, OrderID: 2,
Name: "pipeline2", Name: "pipeline2",
Alias: "pipeline2", Alias: "pipeline2",

View File

@ -601,7 +601,7 @@ func postableFromPipelines(gettablePipelines []pipelinetypes.GettablePipeline) p
for _, p := range gettablePipelines { for _, p := range gettablePipelines {
postable := pipelinetypes.PostablePipeline{ postable := pipelinetypes.PostablePipeline{
ID: p.ID, ID: p.ID.StringValue(),
OrderID: p.OrderID, OrderID: p.OrderID,
Name: p.Name, Name: p.Name,
Alias: p.Alias, Alias: p.Alias,

View File

@ -19,8 +19,8 @@ type StoreablePipeline struct {
types.UserAuditable types.UserAuditable
types.TimeAuditable types.TimeAuditable
types.Identifiable
OrgID string `json:"-" bun:"org_id,notnull"` OrgID string `json:"-" bun:"org_id,notnull"`
ID string `json:"id" bun:"id,pk,type:text"`
OrderID int `json:"orderId" bun:"order_id"` OrderID int `json:"orderId" bun:"order_id"`
Enabled bool `json:"enabled" bun:"enabled"` Enabled bool `json:"enabled" bun:"enabled"`
Name string `json:"name" bun:"name,type:varchar(400),notnull"` Name string `json:"name" bun:"name,type:varchar(400),notnull"`