From 251a14edba0bc6ccb637c6e764e6129409688a21 Mon Sep 17 00:00:00 2001 From: Sven Urbanski Date: Fri, 27 Sep 2024 13:35:46 +0200 Subject: [PATCH 1/2] fix: pass context along to avoid disconnected spans Ref: SRX-YNEAHU --- pkg/db/cutoff.go | 2 +- pkg/db/db.go | 126 +++++++++--------- .../cd-service/pkg/repository/repository.go | 6 +- .../cd-service/pkg/repository/transformer.go | 40 +++--- .../pkg/service/commit_deployment.go | 3 +- services/cd-service/pkg/service/version.go | 2 +- .../pkg/repository/repository.go | 2 +- .../pkg/repository/transformer.go | 2 +- 8 files changed, 94 insertions(+), 89 deletions(-) diff --git a/pkg/db/cutoff.go b/pkg/db/cutoff.go index 804b61da3..903b87419 100644 --- a/pkg/db/cutoff.go +++ b/pkg/db/cutoff.go @@ -28,7 +28,7 @@ import ( ) func DBReadCutoff(h *DBHandler, ctx context.Context, tx *sql.Tx) (*EslVersion, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBReadCutoff") + span, ctx := tracer.StartSpanFromContext(ctx, "DBReadCutoff") defer span.Finish() selectQuery := h.AdaptQuery("SELECT eslVersion FROM cutoff ORDER BY eslVersion DESC LIMIT 1;") diff --git a/pkg/db/db.go b/pkg/db/db.go index 136f49848..a7fb265f1 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -304,7 +304,7 @@ func (h *DBHandler) DBWriteEslEventInternal(ctx context.Context, eventType Event if tx == nil { return fmt.Errorf("DBWriteEslEventInternal: no transaction provided") } - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteEslEventInternal") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteEslEventInternal") defer span.Finish() dataMap, err := convertObjectToMap(data) @@ -468,7 +468,7 @@ func (h *DBHandler) DBReadEslEventInternal(ctx context.Context, tx *sql.Tx, firs // DBReadEslEventLaterThan returns the first row of the esl table that has an eslVersion > the given eslVersion func (h *DBHandler) DBReadEslEventLaterThan(ctx context.Context, tx *sql.Tx, eslVersion EslVersion) (*EslEventRow, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBReadEslEventLaterThan") + span, ctx := tracer.StartSpanFromContext(ctx, "DBReadEslEventLaterThan") defer span.Finish() sort := "ASC" @@ -557,7 +557,7 @@ func (h *DBHandler) DBSelectAnyRelease(ctx context.Context, tx *sql.Tx, ignorePr "SELECT eslVersion, created, appName, metadata, manifests, releaseVersion, deleted " + " FROM releases " + " LIMIT 1;")) - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAnyRelease") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAnyRelease") defer span.Finish() span.SetTag("query", selectQuery) @@ -641,7 +641,7 @@ func (h *DBHandler) DBSelectReleasesByAppLatestEslVersion(ctx context.Context, t } func (h *DBHandler) DBSelectAllReleasesOfApp(ctx context.Context, tx *sql.Tx, app string) (*DBAllReleasesWithMetaData, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAllReleasesOfApp") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAllReleasesOfApp") defer span.Finish() selectQuery := h.AdaptQuery(fmt.Sprintf( "SELECT eslVersion, created, appName, metadata " + @@ -659,7 +659,7 @@ func (h *DBHandler) DBSelectAllReleasesOfApp(ctx context.Context, tx *sql.Tx, ap } func (h *DBHandler) DBSelectAllReleasesOfAllApps(ctx context.Context, tx *sql.Tx) (map[string][]int64, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAllReleasesOfAllApps") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAllReleasesOfAllApps") defer span.Finish() selectQuery := h.AdaptQuery(`SELECT all_releases.appname, @@ -843,7 +843,7 @@ func (h *DBHandler) processReleaseRows(ctx context.Context, err error, rows *sql } func (h *DBHandler) DBInsertRelease(ctx context.Context, transaction *sql.Tx, release DBReleaseWithMetaData, previousEslVersion EslVersion) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBInsertRelease") + span, ctx := tracer.StartSpanFromContext(ctx, "DBInsertRelease") defer span.Finish() metadataJson, err := json.Marshal(release.Metadata) if err != nil { @@ -893,7 +893,7 @@ func (h *DBHandler) DBInsertRelease(ctx context.Context, transaction *sql.Tx, re } func (h *DBHandler) DBDeleteReleaseFromAllReleases(ctx context.Context, transaction *sql.Tx, application string, releaseToDelete uint64) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBDeleteReleaseFromAllReleases") + span, ctx := tracer.StartSpanFromContext(ctx, "DBDeleteReleaseFromAllReleases") defer span.Finish() allReleases, err := h.DBSelectAllReleasesOfApp(ctx, transaction, application) @@ -919,7 +919,7 @@ func (h *DBHandler) DBDeleteReleaseFromAllReleases(ctx context.Context, transact // DBClearReleases : Sets all_releases for app to empty list and marks every release as deleted func (h *DBHandler) DBClearReleases(ctx context.Context, transaction *sql.Tx, application string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBClearReleases") + span, ctx := tracer.StartSpanFromContext(ctx, "DBClearReleases") defer span.Finish() allReleases, err := h.DBSelectAllReleasesOfApp(ctx, transaction, application) @@ -941,7 +941,7 @@ func (h *DBHandler) DBClearReleases(ctx context.Context, transaction *sql.Tx, ap } func (h *DBHandler) DBDeleteFromReleases(ctx context.Context, transaction *sql.Tx, application string, releaseToDelete uint64) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBDeleteFromReleases") + span, ctx := tracer.StartSpanFromContext(ctx, "DBDeleteFromReleases") defer span.Finish() targetRelease, err := h.DBSelectReleaseByVersion(ctx, transaction, application, releaseToDelete, true) @@ -962,7 +962,7 @@ func (h *DBHandler) DBDeleteFromReleases(ctx context.Context, transaction *sql.T } func (h *DBHandler) DBInsertAllReleases(ctx context.Context, transaction *sql.Tx, app string, allVersions []int64, previousEslVersion EslVersion) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBInsertAllReleases") + span, ctx := tracer.StartSpanFromContext(ctx, "DBInsertAllReleases") defer span.Finish() slices.Sort(allVersions) metadataJson, err := json.Marshal(DBAllReleaseMetaData{ @@ -999,7 +999,7 @@ func (h *DBHandler) DBInsertAllReleases(ctx context.Context, transaction *sql.Tx // APPS func (h *DBHandler) DBWriteAllApplications(ctx context.Context, transaction *sql.Tx, previousVersion int64, applications []string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteAllApplications") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteAllApplications") defer span.Finish() slices.Sort(applications) // we don't really *need* the sorting, it's just for convenience jsonToInsert, err := json.Marshal(AllApplicationsJson{ @@ -1027,7 +1027,7 @@ func (h *DBHandler) DBWriteAllApplications(ctx context.Context, transaction *sql } func (h *DBHandler) WriteEvent(ctx context.Context, transaction *sql.Tx, transformerID TransformerID, eventuuid string, eventType event.EventType, sourceCommitHash string, eventJson []byte) error { - span, _ := tracer.StartSpanFromContext(ctx, "WriteEvent") + span, ctx := tracer.StartSpanFromContext(ctx, "WriteEvent") defer span.Finish() insertQuery := h.AdaptQuery("INSERT INTO commit_events (uuid, timestamp, commitHash, eventType, json, transformereslVersion) VALUES (?, ?, ?, ?, ?, ?);") @@ -1568,7 +1568,7 @@ func (h *DBHandler) RunCustomMigrations( } func (h *DBHandler) DBSelectLatestDeployment(ctx context.Context, tx *sql.Tx, appSelector string, envSelector string) (*Deployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectLatestDeployment") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectLatestDeployment") defer span.Finish() selectQuery := h.AdaptQuery(fmt.Sprintf( @@ -1597,7 +1597,7 @@ func (h *DBHandler) DBSelectLatestDeployment(ctx context.Context, tx *sql.Tx, ap } func (h *DBHandler) DBSelectAllLatestDeployments(ctx context.Context, tx *sql.Tx, envName string) (map[string]*int64, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAllLatestDeployments") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAllLatestDeployments") defer span.Finish() selectQuery := h.AdaptQuery( @@ -1669,7 +1669,7 @@ func processAllLatestDeployments(rows *sql.Rows) (map[string]*int64, error) { } func (h *DBHandler) DBSelectSpecificDeployment(ctx context.Context, tx *sql.Tx, appSelector string, envSelector string, releaseVersion uint64) (*Deployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectSpecificDeployment") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectSpecificDeployment") defer span.Finish() selectQuery := h.AdaptQuery(fmt.Sprintf( @@ -1748,7 +1748,7 @@ func processDeployment(rows *sql.Rows) (*Deployment, error) { } func (h *DBHandler) DBSelectDeploymentHistory(ctx context.Context, tx *sql.Tx, appSelector string, envSelector string, limit int) ([]Deployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectDeploymentHistory") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectDeploymentHistory") defer span.Finish() selectQuery := h.AdaptQuery(fmt.Sprintf( @@ -1928,7 +1928,7 @@ type DBAppWithMetaData struct { } func (h *DBHandler) DBInsertApplication(ctx context.Context, transaction *sql.Tx, appName string, previousEslVersion EslVersion, stateChange AppStateChange, metaData DBAppMetaData) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBInsertApplication") + span, ctx := tracer.StartSpanFromContext(ctx, "DBInsertApplication") defer span.Finish() jsonToInsert, err := json.Marshal(metaData) if err != nil { @@ -2074,7 +2074,7 @@ func (h *DBHandler) DBSelectApp(ctx context.Context, tx *sql.Tx, appName string) // DBWriteDeployment writes one deployment, meaning "what should be deployed" func (h *DBHandler) DBWriteDeployment(ctx context.Context, tx *sql.Tx, deployment Deployment, previousEslVersion EslVersion, skipOverview bool) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteDeployment") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteDeployment") defer span.Finish() if h == nil { return nil @@ -2122,7 +2122,7 @@ func (h *DBHandler) DBWriteDeployment(ctx context.Context, tx *sql.Tx, deploymen // DBSelectAllDeploymentsForApp Returns most recent version of deployments for app with name 'appName' func (h *DBHandler) DBSelectAllDeploymentsForApp(ctx context.Context, tx *sql.Tx, appName string) (*AllDeploymentsForApp, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAllDeploymentsForApp") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAllDeploymentsForApp") defer span.Finish() if h == nil { return nil, nil @@ -2145,7 +2145,7 @@ func (h *DBHandler) DBSelectAllDeploymentsForApp(ctx context.Context, tx *sql.Tx // DBUpdateAllDeploymentsForApp Updates table entry for application with name 'appName' with 'envName' -> 'version' func (h *DBHandler) DBUpdateAllDeploymentsForApp(ctx context.Context, tx *sql.Tx, appName, envName string, version int64) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBUpdateAllDeploymentsForApp") + span, ctx := tracer.StartSpanFromContext(ctx, "DBUpdateAllDeploymentsForApp") defer span.Finish() if h == nil { return nil @@ -2183,7 +2183,7 @@ func (h *DBHandler) DBUpdateAllDeploymentsForApp(ctx context.Context, tx *sql.Tx // DBClearAllDeploymentsForApp Clears all deployments map. Used when undeploying an application func (h *DBHandler) DBClearAllDeploymentsForApp(ctx context.Context, tx *sql.Tx, appName string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBUpdateAllDeploymentsForApp") + span, ctx := tracer.StartSpanFromContext(ctx, "DBUpdateAllDeploymentsForApp") defer span.Finish() if h == nil { return nil @@ -2217,7 +2217,7 @@ func (h *DBHandler) DBClearAllDeploymentsForApp(ctx context.Context, tx *sql.Tx, // CUSTOM MIGRATIONS func (h *DBHandler) RunCustomMigrationReleases(ctx context.Context, getAllAppsFun GetAllAppsFun, writeAllReleasesFun WriteAllReleasesFun) error { - span, _ := tracer.StartSpanFromContext(ctx, "RunCustomMigrationReleases") + span, ctx := tracer.StartSpanFromContext(ctx, "RunCustomMigrationReleases") defer span.Finish() return h.WithTransaction(ctx, false, func(ctx context.Context, transaction *sql.Tx) error { @@ -2261,7 +2261,7 @@ func (h *DBHandler) needsReleasesMigrations(ctx context.Context, transaction *sq } func (h *DBHandler) RunCustomMigrationDeployments(ctx context.Context, getAllDeploymentsFun WriteAllDeploymentsFun) error { - span, _ := tracer.StartSpanFromContext(ctx, "RunCustomMigrationDeployments") + span, ctx := tracer.StartSpanFromContext(ctx, "RunCustomMigrationDeployments") defer span.Finish() return h.WithTransaction(ctx, false, func(ctx context.Context, transaction *sql.Tx) error { @@ -2282,7 +2282,7 @@ func (h *DBHandler) RunCustomMigrationDeployments(ctx context.Context, getAllDep } func (h *DBHandler) RunCustomMigrationAllDeployments(ctx context.Context, writeAllDeployments WriteAllDeploymentsFun) error { - span, _ := tracer.StartSpanFromContext(ctx, "RunCustomMigrationDeployments") + span, ctx := tracer.StartSpanFromContext(ctx, "RunCustomMigrationDeployments") defer span.Finish() return h.WithTransaction(ctx, false, func(ctx context.Context, transaction *sql.Tx) error { @@ -2563,7 +2563,7 @@ func (h *DBHandler) NeedsMigrations(ctx context.Context) (bool, error) { // For commit_events migrations, we need some transformer to be on the database before we run their migrations. func (h *DBHandler) RunCustomMigrationsEventSourcingLight(ctx context.Context) error { return h.WithTransaction(ctx, false, func(ctx context.Context, transaction *sql.Tx) error { - span, _ := tracer.StartSpanFromContext(ctx, "RunCustomMigrationsEventSourcingLight") + span, ctx := tracer.StartSpanFromContext(ctx, "RunCustomMigrationsEventSourcingLight") defer span.Finish() needsMigrating, err := h.NeedsEventSourcingLightMigrations(ctx, transaction) @@ -2831,7 +2831,7 @@ func (h *DBHandler) DBSelectEnvironmentLock(ctx context.Context, tx *sql.Tx, env } func (h *DBHandler) DBWriteEnvironmentLock(ctx context.Context, tx *sql.Tx, lockID, environment string, metadata LockMetadata) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteEnvironmentLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteEnvironmentLock") defer span.Finish() if h == nil { return nil @@ -2866,7 +2866,7 @@ func (h *DBHandler) DBWriteEnvironmentLock(ctx context.Context, tx *sql.Tx, lock } func (h *DBHandler) DBWriteEnvironmentLockInternal(ctx context.Context, tx *sql.Tx, envLock EnvironmentLock, previousEslVersion EslVersion) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteEnvironmentLockInternal") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteEnvironmentLockInternal") defer span.Finish() if h == nil { @@ -2912,7 +2912,7 @@ func (h *DBHandler) DBWriteEnvironmentLockInternal(ctx context.Context, tx *sql. // DBSelectEnvLockHistory returns the last N events associated with some lock on some environment. Currently only used in testing. func (h *DBHandler) DBSelectEnvLockHistory(ctx context.Context, tx *sql.Tx, environmentName, lockID string, limit int) ([]EnvironmentLock, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectEnvLocks") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectEnvLocks") defer span.Finish() if h == nil { return nil, nil @@ -3048,7 +3048,7 @@ func (h *DBHandler) DBSelectAllEnvironmentLocks(ctx context.Context, tx *sql.Tx, } func (h *DBHandler) DBSelectEnvironmentLockSet(ctx context.Context, tx *sql.Tx, environment string, lockIDs []string) ([]EnvironmentLock, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectEnvironmentLockSet") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectEnvironmentLockSet") defer span.Finish() if len(lockIDs) == 0 { @@ -3131,7 +3131,7 @@ func (h *DBHandler) DBSelectEnvironmentLockSet(ctx context.Context, tx *sql.Tx, } func (h *DBHandler) DBWriteAllEnvironmentLocks(ctx context.Context, transaction *sql.Tx, previousVersion int64, environment string, lockIds []string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteAllEnvironmentLocks") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteAllEnvironmentLocks") defer span.Finish() slices.Sort(lockIds) // we don't really *need* the sorting, it's just for convenience jsonToInsert, err := json.Marshal(AllEnvLocksJson{ @@ -3161,7 +3161,7 @@ func (h *DBHandler) DBWriteAllEnvironmentLocks(ctx context.Context, transaction } func (h *DBHandler) DBDeleteEnvironmentLock(ctx context.Context, tx *sql.Tx, environment, lockID string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBDeleteEnvironmentLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBDeleteEnvironmentLock") defer span.Finish() if h == nil { return nil @@ -3259,7 +3259,7 @@ type DBApplicationLock struct { } func (h *DBHandler) DBWriteAllAppLocks(ctx context.Context, transaction *sql.Tx, previousVersion int64, environment, appName string, lockIds []string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteAllAppLocks") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteAllAppLocks") defer span.Finish() slices.Sort(lockIds) // we don't really *need* the sorting, it's just for convenience jsonToInsert, err := json.Marshal(AllAppLocksJson{ @@ -3288,7 +3288,7 @@ func (h *DBHandler) DBWriteAllAppLocks(ctx context.Context, transaction *sql.Tx, } func (h *DBHandler) DBSelectAllAppLocks(ctx context.Context, tx *sql.Tx, environment, appName string) (*AllAppLocksGo, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAllAppLocks") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAllAppLocks") defer span.Finish() if h == nil { return nil, nil @@ -3433,7 +3433,7 @@ func (h *DBHandler) DBSelectAppLock(ctx context.Context, tx *sql.Tx, environment } func (h *DBHandler) DBSelectAppLockSet(ctx context.Context, tx *sql.Tx, environment, appName string, lockIDs []string) ([]ApplicationLock, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAppLockSet") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAppLockSet") defer span.Finish() if len(lockIDs) == 0 { @@ -3518,7 +3518,7 @@ func (h *DBHandler) DBSelectAppLockSet(ctx context.Context, tx *sql.Tx, environm } func (h *DBHandler) DBWriteApplicationLock(ctx context.Context, tx *sql.Tx, lockID, environment, appName string, metadata LockMetadata) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteApplicationLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteApplicationLock") defer span.Finish() if h == nil { @@ -3555,7 +3555,7 @@ func (h *DBHandler) DBWriteApplicationLock(ctx context.Context, tx *sql.Tx, lock } func (h *DBHandler) DBWriteApplicationLockInternal(ctx context.Context, tx *sql.Tx, appLock ApplicationLock, previousEslVersion EslVersion) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteApplicationLockInternal") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteApplicationLockInternal") defer span.Finish() if h == nil { @@ -3601,7 +3601,7 @@ func (h *DBHandler) DBWriteApplicationLockInternal(ctx context.Context, tx *sql. } func (h *DBHandler) DBDeleteApplicationLock(ctx context.Context, tx *sql.Tx, environment, appName, lockID string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBDeleteApplicationLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBDeleteApplicationLock") defer span.Finish() if h == nil { @@ -3639,7 +3639,7 @@ func (h *DBHandler) DBDeleteApplicationLock(ctx context.Context, tx *sql.Tx, env } func (h *DBHandler) DBSelectAnyActiveAppLock(ctx context.Context, tx *sql.Tx) (*AllAppLocksGo, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBDeleteApplicationLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBDeleteApplicationLock") defer span.Finish() selectQuery := h.AdaptQuery( @@ -3695,7 +3695,7 @@ func (h *DBHandler) DBSelectAnyActiveAppLock(ctx context.Context, tx *sql.Tx) (* // DBSelectAppLockHistory returns the last N events associated with some lock on some environment for some app. Currently only used in testing. func (h *DBHandler) DBSelectAppLockHistory(ctx context.Context, tx *sql.Tx, environmentName, appName, lockID string, limit int) ([]ApplicationLock, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAppLockHistory") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAppLockHistory") defer span.Finish() if h == nil { @@ -3810,7 +3810,7 @@ type DBTeamLock struct { } func (h *DBHandler) DBSelectAnyActiveTeamLock(ctx context.Context, tx *sql.Tx) (*AllTeamLocksGo, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAnyActiveTeamLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAnyActiveTeamLock") defer span.Finish() selectQuery := h.AdaptQuery( @@ -3825,7 +3825,7 @@ func (h *DBHandler) DBSelectAnyActiveTeamLock(ctx context.Context, tx *sql.Tx) ( } func (h *DBHandler) DBWriteTeamLock(ctx context.Context, tx *sql.Tx, lockID, environment, teamName string, metadata LockMetadata) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteTeamLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteTeamLock") defer span.Finish() if h == nil { return nil @@ -3861,7 +3861,7 @@ func (h *DBHandler) DBWriteTeamLock(ctx context.Context, tx *sql.Tx, lockID, env } func (h *DBHandler) DBWriteTeamLockInternal(ctx context.Context, tx *sql.Tx, teamLock TeamLock, previousEslVersion EslVersion) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteTeamLockInternal") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteTeamLockInternal") defer span.Finish() if h == nil { @@ -3908,7 +3908,7 @@ func (h *DBHandler) DBWriteTeamLockInternal(ctx context.Context, tx *sql.Tx, tea } func (h *DBHandler) DBWriteAllTeamLocks(ctx context.Context, transaction *sql.Tx, previousVersion int64, environment, teamName string, lockIds []string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteAllTeamLocks") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteAllTeamLocks") defer span.Finish() slices.Sort(lockIds) // we don't really *need* the sorting, it's just for convenience jsonToInsert, err := json.Marshal(AllTeamLocksJson{ @@ -4012,7 +4012,7 @@ func (h *DBHandler) DBSelectTeamLock(ctx context.Context, tx *sql.Tx, environmen return nil, nil // no rows, but also no error } func (h *DBHandler) DBSelectAllTeamLocks(ctx context.Context, tx *sql.Tx, environment, teamName string) (*AllTeamLocksGo, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAllTeamLocks") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAllTeamLocks") defer span.Finish() if h == nil { return nil, nil @@ -4029,7 +4029,7 @@ func (h *DBHandler) DBSelectAllTeamLocks(ctx context.Context, tx *sql.Tx, enviro } func (h *DBHandler) DBDeleteTeamLock(ctx context.Context, tx *sql.Tx, environment, teamName, lockID string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBDeleteTeamLock") + span, ctx := tracer.StartSpanFromContext(ctx, "DBDeleteTeamLock") defer span.Finish() if h == nil { @@ -4159,7 +4159,7 @@ func (h *DBHandler) selectTeamLocks(ctx context.Context, tx *sql.Tx, environment // DBSelectTeamLockHistory returns the last N events associated with some lock on some environment for some team. Currently only used in testing. func (h *DBHandler) DBSelectTeamLockHistory(ctx context.Context, tx *sql.Tx, environmentName, teamName, lockID string, limit int) ([]TeamLock, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectTeamLockHistory") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectTeamLockHistory") defer span.Finish() if h == nil { @@ -4318,7 +4318,7 @@ func (h *DBHandler) DBSelectAnyDeploymentAttempt(ctx context.Context, tx *sql.Tx } func (h *DBHandler) DBSelectDeploymentAttemptHistory(ctx context.Context, tx *sql.Tx, environmentName, appName string, limit int) ([]QueuedDeployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectDeploymentAttemptHistory") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectDeploymentAttemptHistory") defer span.Finish() if h == nil { @@ -4370,7 +4370,7 @@ func (h *DBHandler) DBSelectDeploymentAttemptHistory(ctx context.Context, tx *sq } func (h *DBHandler) DBSelectLatestDeploymentAttempt(ctx context.Context, tx *sql.Tx, environmentName, appName string) (*QueuedDeployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectLatestDeploymentAttempt") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectLatestDeploymentAttempt") defer span.Finish() if h == nil { @@ -4392,7 +4392,7 @@ func (h *DBHandler) DBSelectLatestDeploymentAttempt(ctx context.Context, tx *sql } func (h *DBHandler) DBWriteDeploymentAttempt(ctx context.Context, tx *sql.Tx, envName, appName string, version *int64, skipOverview bool) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteDeploymentAttempt") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteDeploymentAttempt") defer span.Finish() if h == nil { @@ -4430,7 +4430,7 @@ func (h *DBHandler) DBDeleteDeploymentAttempt(ctx context.Context, tx *sql.Tx, e } func (h *DBHandler) dbWriteDeploymentAttemptInternal(ctx context.Context, tx *sql.Tx, deployment *QueuedDeployment, skipOverview bool) error { - span, _ := tracer.StartSpanFromContext(ctx, "dbWriteDeploymentAttemptInternal") + span, ctx := tracer.StartSpanFromContext(ctx, "dbWriteDeploymentAttemptInternal") defer span.Finish() if h == nil { @@ -4481,7 +4481,7 @@ func (h *DBHandler) dbWriteDeploymentAttemptInternal(ctx context.Context, tx *sq } func (h *DBHandler) processDeploymentAttemptsRow(ctx context.Context, rows *sql.Rows, err error) (*QueuedDeployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "processDeploymentAttemptsRow") + span, ctx := tracer.StartSpanFromContext(ctx, "processDeploymentAttemptsRow") defer span.Finish() if err != nil { @@ -4509,7 +4509,7 @@ func (h *DBHandler) processDeploymentAttemptsRow(ctx context.Context, rows *sql. // processSingleDeploymentAttemptsRow only processes the row. It assumes that there is an element ready to be processed in rows. func (h *DBHandler) processSingleDeploymentAttemptsRow(ctx context.Context, rows *sql.Rows) (*QueuedDeployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "processSingleDeploymentAttemptsRow") + span, ctx := tracer.StartSpanFromContext(ctx, "processSingleDeploymentAttemptsRow") defer span.Finish() //exhaustruct:ignore @@ -4533,7 +4533,7 @@ func (h *DBHandler) processSingleDeploymentAttemptsRow(ctx context.Context, rows // processSingleDeploymentRow only processes the row. It assumes that there is an element ready to be processed in rows. func (h *DBHandler) processSingleDeploymentRow(ctx context.Context, rows *sql.Rows) (*Deployment, error) { - span, _ := tracer.StartSpanFromContext(ctx, "processSingleDeploymentRow") + span, ctx := tracer.StartSpanFromContext(ctx, "processSingleDeploymentRow") defer span.Finish() var row = &DBDeployment{ EslVersion: 0, @@ -4750,7 +4750,7 @@ LIMIT ? } func (h *DBHandler) DBWriteEnvironment(ctx context.Context, tx *sql.Tx, environmentName string, environmentConfig config.EnvironmentConfig) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteEnvironment") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteEnvironment") defer span.Finish() if h == nil { @@ -4802,7 +4802,7 @@ func (h *DBHandler) DBWriteEnvironment(ctx context.Context, tx *sql.Tx, environm } func (h *DBHandler) DBSelectAllEnvironments(ctx context.Context, transaction *sql.Tx) (*DBAllEnvironments, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAllEnvironments") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAllEnvironments") defer span.Finish() if h == nil { @@ -4866,7 +4866,7 @@ func (h *DBHandler) DBSelectAllEnvironments(ctx context.Context, transaction *sq } func (h *DBHandler) DBWriteAllEnvironments(ctx context.Context, transaction *sql.Tx, environmentNames []string) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteAllEnvironments") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteAllEnvironments") defer span.Finish() jsonToInsert, err := json.Marshal(environmentNames) @@ -4904,7 +4904,7 @@ func (h *DBHandler) DBWriteAllEnvironments(ctx context.Context, transaction *sql } func (h *DBHandler) DBSelectAnyEnvironment(ctx context.Context, tx *sql.Tx) (*DBAllEnvironments, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBSelectAnyEnvironment") + span, ctx := tracer.StartSpanFromContext(ctx, "DBSelectAnyEnvironment") defer span.Finish() selectQuery := h.AdaptQuery( @@ -5079,7 +5079,7 @@ func (h *DBHandler) ReadLatestOverviewCache(ctx context.Context, transaction *sq } func (h *DBHandler) WriteOverviewCache(ctx context.Context, transaction *sql.Tx, overviewResponse *api.GetOverviewResponse) error { - span, _ := tracer.StartSpanFromContext(ctx, "writeOverviewCache") + span, ctx := tracer.StartSpanFromContext(ctx, "writeOverviewCache") defer span.Finish() if h == nil { return fmt.Errorf("writeOverviewCache: DBHandler is nil") @@ -5111,7 +5111,7 @@ func (h *DBHandler) WriteOverviewCache(ctx context.Context, transaction *sql.Tx, return nil } func (h *DBHandler) DBWriteFailedEslEvent(ctx context.Context, tx *sql.Tx, eslEvent *EslEventRow) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteFailedEslEvent") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteFailedEslEvent") defer span.Finish() if h == nil { return nil @@ -5139,7 +5139,7 @@ func (h *DBHandler) DBWriteFailedEslEvent(ctx context.Context, tx *sql.Tx, eslEv } func (h *DBHandler) DBReadLastFailedEslEvents(ctx context.Context, tx *sql.Tx, limit int) ([]*EslEventRow, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBReadlastFailedEslEvents") + span, ctx := tracer.StartSpanFromContext(ctx, "DBReadlastFailedEslEvents") defer span.Finish() if h == nil { return nil, nil @@ -5192,7 +5192,7 @@ type AllDeploymentsForApp struct { } func (h *DBHandler) DBWriteAllDeploymentsForApp(ctx context.Context, tx *sql.Tx, prev int, appName string, environmentDeployments map[string]int64) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteAllDeploymentsForApp") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteAllDeploymentsForApp") defer span.Finish() if h == nil { @@ -5279,7 +5279,7 @@ func (h *DBHandler) processAllDeploymentRow(ctx context.Context, err error, rows } func (h *DBHandler) DBReadTransactionTimestamp(ctx context.Context, tx *sql.Tx) (*time.Time, error) { - span, _ := tracer.StartSpanFromContext(ctx, "DBReadTransactionTimestamp") + span, ctx := tracer.StartSpanFromContext(ctx, "DBReadTransactionTimestamp") defer span.Finish() if h == nil { @@ -5340,7 +5340,7 @@ func (h *DBHandler) DBReadTransactionTimestamp(ctx context.Context, tx *sql.Tx) } func (h *DBHandler) DBWriteCommitTransactionTimestamp(ctx context.Context, tx *sql.Tx, commitHash string, timestamp time.Time) error { - span, _ := tracer.StartSpanFromContext(ctx, "DBWriteCommitTransactionTimestamp") + span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteCommitTransactionTimestamp") defer span.Finish() if h == nil { diff --git a/services/cd-service/pkg/repository/repository.go b/services/cd-service/pkg/repository/repository.go index ce67843ae..eefc99b72 100644 --- a/services/cd-service/pkg/repository/repository.go +++ b/services/cd-service/pkg/repository/repository.go @@ -2186,7 +2186,7 @@ func (s *State) WriteAllCurrentlyDeployed(ctx context.Context, transaction *sql. // WriteCurrentEnvironmentLocks gets all locks on any environment in manifest and writes them to the DB func (s *State) WriteCurrentEnvironmentLocks(ctx context.Context, transaction *sql.Tx, dbHandler *db.DBHandler) error { - ddSpan, _ := tracer.StartSpanFromContext(ctx, "WriteCurrentEnvironmentLocks") + ddSpan, ctx := tracer.StartSpanFromContext(ctx, "WriteCurrentEnvironmentLocks") defer ddSpan.Finish() _, envNames, err := s.GetEnvironmentConfigsSortedFromManifest() // this is intentional, when doing custom migrations (which is where this function is called), we want to read from the manifest repo explicitly if err != nil { @@ -2236,7 +2236,7 @@ func (s *State) WriteCurrentEnvironmentLocks(ctx context.Context, transaction *s } func (s *State) WriteCurrentApplicationLocks(ctx context.Context, transaction *sql.Tx, dbHandler *db.DBHandler) error { - ddSpan, _ := tracer.StartSpanFromContext(ctx, "WriteCurrentApplicationLocks") + ddSpan, ctx := tracer.StartSpanFromContext(ctx, "WriteCurrentApplicationLocks") defer ddSpan.Finish() _, envNames, err := s.GetEnvironmentConfigsSortedFromManifest() // this is intentional, when doing custom migrations (which is where this function is called), we want to read from the manifest repo explicitly @@ -2295,7 +2295,7 @@ func (s *State) WriteCurrentApplicationLocks(ctx context.Context, transaction *s } func (s *State) WriteAllQueuedAppVersions(ctx context.Context, transaction *sql.Tx, dbHandler *db.DBHandler) error { - ddSpan, _ := tracer.StartSpanFromContext(ctx, "GetAllQueuedAppVersions") + ddSpan, ctx := tracer.StartSpanFromContext(ctx, "GetAllQueuedAppVersions") defer ddSpan.Finish() _, envNames, err := s.GetEnvironmentConfigsSortedFromManifest() diff --git a/services/cd-service/pkg/repository/transformer.go b/services/cd-service/pkg/repository/transformer.go index 34045f867..a8f353ad5 100644 --- a/services/cd-service/pkg/repository/transformer.go +++ b/services/cd-service/pkg/repository/transformer.go @@ -289,7 +289,7 @@ type Transformer interface { } type TransformerContext interface { - Execute(t Transformer, transaction *sql.Tx) error + Execute(ctx context.Context, t Transformer, transaction *sql.Tx) error AddAppEnv(app string, env string, team string) DeleteEnvFromApp(app string, env string) } @@ -299,11 +299,10 @@ func RunTransformer(ctx context.Context, t Transformer, s *State, transaction *s ChangedApps: nil, DeletedRootApps: nil, Commits: nil, - Context: ctx, State: s, Stack: [][]string{nil}, } - if err := runner.Execute(t, transaction); err != nil { + if err := runner.Execute(ctx, t, transaction); err != nil { return "", nil, err } commitMsg := "" @@ -318,8 +317,8 @@ func RunTransformer(ctx context.Context, t Transformer, s *State, transaction *s } type transformerRunner struct { - Context context.Context - State *State + //Context context.Context + State *State // Stores the current stack of commit messages. Each entry of // the outer slice corresponds to a step being executed. Each // entry of the inner slices correspond to a message generated @@ -330,9 +329,9 @@ type transformerRunner struct { Commits *CommitIds } -func (r *transformerRunner) Execute(t Transformer, transaction *sql.Tx) error { +func (r *transformerRunner) Execute(ctx context.Context, t Transformer, transaction *sql.Tx) error { r.Stack = append(r.Stack, nil) - msg, err := t.Transform(r.Context, r.State, r, transaction) + msg, err := t.Transform(ctx, r.State, r, transaction) if err != nil { return err } @@ -765,7 +764,7 @@ func (c *CreateApplicationVersion) Transform( TransformerEslVersion: c.TransformerEslVersion, SkipOverview: false, } - err := t.Execute(d, transaction) + err := t.Execute(ctx, d, transaction) if err != nil { _, ok := err.(*LockedError) if ok { @@ -1369,7 +1368,7 @@ func (c *CreateUndeployApplicationVersion) Transform( CiLink: "", SkipOverview: false, } - err := t.Execute(d, transaction) + err := t.Execute(ctx, d, transaction) if err != nil { _, ok := err.(*LockedError) if ok { @@ -2193,7 +2192,7 @@ func (c *CreateEnvironmentGroupLock) Transform( CiLink: c.CiLink, AllowedDomains: c.AllowedDomains, } - if err := t.Execute(&x, transaction); err != nil { + if err := t.Execute(ctx, &x, transaction); err != nil { return "", err } } @@ -2237,7 +2236,7 @@ func (c *DeleteEnvironmentGroupLock) Transform( LockId: c.LockId, TransformerEslVersion: c.TransformerEslVersion, } - if err := t.Execute(&x, transaction); err != nil { + if err := t.Execute(ctx, &x, transaction); err != nil { return "", err } } @@ -3050,7 +3049,7 @@ func (c *DeployApplicationVersion) Transform( TransformerEslVersion: c.TransformerEslVersion, } - if err := t.Execute(d, transaction); err != nil { + if err := t.Execute(ctx, d, transaction); err != nil { return "", err } } @@ -3375,6 +3374,9 @@ func (c *ReleaseTrain) Prognosis( ) ReleaseTrainPrognosis { span, ctx := tracer.StartSpanFromContext(ctx, "ReleaseTrain Prognosis") defer span.Finish() + span.SetTag("targetEnv", c.Target) + span.SetTag("targetType", c.TargetType) + span.SetTag("team", c.Team) var targetGroupName = c.Target var envGroupConfigs, isEnvGroup = getEnvironmentGroupsEnvironmentsOrEnvironment(configs, targetGroupName, c.TargetType) @@ -3456,6 +3458,8 @@ func (c *ReleaseTrain) Transform( } prognosis := c.Prognosis(ctx, state, transaction, configs) + span2, ctx := tracer.StartSpanFromContext(ctx, "ReleaseTrain Apply") + defer span2.Finish() if prognosis.Error != nil { return "", prognosis.Error @@ -3477,7 +3481,7 @@ func (c *ReleaseTrain) Transform( trainGroup = conversion.FromString(targetGroupName) } - if err := t.Execute(&envReleaseTrain{ + if err := t.Execute(ctx, &envReleaseTrain{ Parent: c, Env: envName, EnvConfigs: configs, @@ -3522,6 +3526,8 @@ func (c *envReleaseTrain) prognosis( ) ReleaseTrainEnvironmentPrognosis { span, ctx := tracer.StartSpanFromContext(ctx, "EnvReleaseTrain Prognosis") defer span.Finish() + span.SetTag("env", c.Env) + envConfig := c.EnvGroupConfigs[c.Env] if envConfig.Upstream == nil { return ReleaseTrainEnvironmentPrognosis{ @@ -4027,7 +4033,7 @@ func (c *envReleaseTrain) Transform( CiLink: c.CiLink, SkipOverview: true, } - if err := t.Execute(d, transaction); err != nil { + if err := t.Execute(ctx, d, transaction); err != nil { return "", grpc.InternalError(ctx, fmt.Errorf("unexpected error while deploying app %q to env %q: %w", appName, c.Env, err)) } @@ -4047,7 +4053,7 @@ func (c *envReleaseTrain) Transform( if c.Parent.Team != "" { teamInfo = " for team '" + c.Parent.Team + "'" } - if err := t.Execute(&skippedServices{ + if err := t.Execute(ctx, &skippedServices{ Messages: skipped, TransformerEslVersion: c.TransformerEslVersion, }, transaction); err != nil { @@ -4104,7 +4110,7 @@ func (c *skippedServices) SetEslVersion(id db.TransformerID) { } func (c *skippedServices) Transform( - _ context.Context, + ctx context.Context, _ *State, t TransformerContext, transaction *sql.Tx, @@ -4113,7 +4119,7 @@ func (c *skippedServices) Transform( return "", nil } for _, msg := range c.Messages { - if err := t.Execute(&skippedService{Message: msg, TransformerEslVersion: c.TransformerEslVersion}, transaction); err != nil { + if err := t.Execute(ctx, &skippedService{Message: msg, TransformerEslVersion: c.TransformerEslVersion}, transaction); err != nil { return "", err } } diff --git a/services/cd-service/pkg/service/commit_deployment.go b/services/cd-service/pkg/service/commit_deployment.go index 683e5d809..8b9450617 100644 --- a/services/cd-service/pkg/service/commit_deployment.go +++ b/services/cd-service/pkg/service/commit_deployment.go @@ -58,7 +58,7 @@ ON latest.latest=deployments.eslVersion AND latest.appname=deployments.appname; ` - span, _ := tracer.StartSpanFromContext(ctx, "GetCommitDeploymentInfo") + span, ctx := tracer.StartSpanFromContext(ctx, "GetCommitDeploymentInfo") defer span.Finish() span.SetTag("commit_id", in.CommitId) @@ -130,7 +130,6 @@ ON } func getCommitDeploymentInfoForApp(ctx context.Context, h *db.DBHandler, commitReleaseNumber uint64, app string, environments []string, appDeployments []byte) (*api.AppCommitDeploymentStatus, error) { - span, _ := tracer.StartSpanFromContext(ctx, "getCommitDeploymentInfoForApp") defer span.Finish() span.SetTag("app", app) diff --git a/services/cd-service/pkg/service/version.go b/services/cd-service/pkg/service/version.go index 68a257550..deb8ec8b1 100644 --- a/services/cd-service/pkg/service/version.go +++ b/services/cd-service/pkg/service/version.go @@ -45,7 +45,7 @@ type VersionServiceServer struct { func (o *VersionServiceServer) GetVersion( ctx context.Context, in *api.GetVersionRequest) (*api.GetVersionResponse, error) { - span, _ := tracer.StartSpanFromContext(ctx, "GetVersion") + span, ctx := tracer.StartSpanFromContext(ctx, "GetVersion") defer span.Finish() state := o.Repository.State() diff --git a/services/manifest-repo-export-service/pkg/repository/repository.go b/services/manifest-repo-export-service/pkg/repository/repository.go index d648449fb..50faac7e4 100644 --- a/services/manifest-repo-export-service/pkg/repository/repository.go +++ b/services/manifest-repo-export-service/pkg/repository/repository.go @@ -726,7 +726,7 @@ func (r *repository) updateArgoCdApps(ctx context.Context, transaction *sql.Tx, if apps, err := state.GetEnvironmentApplications(ctx, transaction, env); err != nil { return err } else { - spanCollectData, _ := tracer.StartSpanFromContext(ctx, "collectData") + spanCollectData, ctx := tracer.StartSpanFromContext(ctx, "collectData") defer spanCollectData.Finish() appData := []argocd.AppData{} sort.Strings(apps) diff --git a/services/manifest-repo-export-service/pkg/repository/transformer.go b/services/manifest-repo-export-service/pkg/repository/transformer.go index 9fddf4db1..f2268c880 100644 --- a/services/manifest-repo-export-service/pkg/repository/transformer.go +++ b/services/manifest-repo-export-service/pkg/repository/transformer.go @@ -477,7 +477,7 @@ func (c *DeployApplicationVersion) Transform( } func writeEvent(ctx context.Context, eventId string, sourceCommitId string, filesystem billy.Filesystem, ev event.Event) error { - span, _ := tracer.StartSpanFromContext(ctx, "writeEvent") + span, ctx := tracer.StartSpanFromContext(ctx, "writeEvent") defer span.Finish() if !valid.SHA1CommitID(sourceCommitId) { logger.FromContext(ctx).Sugar().Warnf( From a2157795f20637617e25fda7102758a919f467b6 Mon Sep 17 00:00:00 2001 From: Sven Urbanski Date: Fri, 27 Sep 2024 16:08:51 +0200 Subject: [PATCH 2/2] Apply suggestions from code review --- pkg/db/db.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/db/db.go b/pkg/db/db.go index a7fb265f1..d0664bca2 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -4509,7 +4509,7 @@ func (h *DBHandler) processDeploymentAttemptsRow(ctx context.Context, rows *sql. // processSingleDeploymentAttemptsRow only processes the row. It assumes that there is an element ready to be processed in rows. func (h *DBHandler) processSingleDeploymentAttemptsRow(ctx context.Context, rows *sql.Rows) (*QueuedDeployment, error) { - span, ctx := tracer.StartSpanFromContext(ctx, "processSingleDeploymentAttemptsRow") + span, _ := tracer.StartSpanFromContext(ctx, "processSingleDeploymentAttemptsRow") defer span.Finish() //exhaustruct:ignore @@ -4533,7 +4533,7 @@ func (h *DBHandler) processSingleDeploymentAttemptsRow(ctx context.Context, rows // processSingleDeploymentRow only processes the row. It assumes that there is an element ready to be processed in rows. func (h *DBHandler) processSingleDeploymentRow(ctx context.Context, rows *sql.Rows) (*Deployment, error) { - span, ctx := tracer.StartSpanFromContext(ctx, "processSingleDeploymentRow") + span, _ := tracer.StartSpanFromContext(ctx, "processSingleDeploymentRow") defer span.Finish() var row = &DBDeployment{ EslVersion: 0, @@ -5340,7 +5340,7 @@ func (h *DBHandler) DBReadTransactionTimestamp(ctx context.Context, tx *sql.Tx) } func (h *DBHandler) DBWriteCommitTransactionTimestamp(ctx context.Context, tx *sql.Tx, commitHash string, timestamp time.Time) error { - span, ctx := tracer.StartSpanFromContext(ctx, "DBWriteCommitTransactionTimestamp") + span, _ := tracer.StartSpanFromContext(ctx, "DBWriteCommitTransactionTimestamp") defer span.Finish() if h == nil {