From 003d8f237749c0c85e7139353a96df65a0b5bb16 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Thu, 11 Dec 2025 12:17:16 -0500 Subject: [PATCH 1/3] Add eyecatcher log lines at info-level for transaction lifecycle Signed-off-by: Peter Broadhurst --- Dockerfile | 2 +- internal/operations/operation_updater.go | 16 ++++++++++++++-- internal/txwriter/txwriter.go | 8 ++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d17c98250c..df73ed7f3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,7 +66,7 @@ FROM alpine:3.21 AS sbom WORKDIR / ADD . /SBOM RUN apk add --no-cache curl -RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.48.3 +RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.68.1 RUN trivy fs --format spdx-json --output /sbom.spdx.json /SBOM RUN trivy sbom /sbom.spdx.json --severity UNKNOWN,HIGH,CRITICAL --db-repository public.ecr.aws/aquasecurity/trivy-db --exit-code 1 diff --git a/internal/operations/operation_updater.go b/internal/operations/operation_updater.go index 0def75ea2d..dbab1208c3 100644 --- a/internal/operations/operation_updater.go +++ b/internal/operations/operation_updater.go @@ -310,21 +310,33 @@ func (ou *operationUpdater) doUpdate(ctx context.Context, update *core.Operation } // Match a TX we already retrieved, if found add a specified Blockchain Transaction ID to it + var txnIDStr string + var idempotencyKeyStr string var tx *core.Transaction - if op.Transaction != nil && update.BlockchainTXID != "" { + if op.Transaction != nil { for _, candidate := range transactions { if op.Transaction.Equals(candidate.ID) { tx = candidate + txnIDStr = candidate.ID.String() + idempotencyKeyStr = string(candidate.IdempotencyKey) break } } } - if tx != nil { + if tx != nil && update.BlockchainTXID != "" { if err := ou.txHelper.AddBlockchainTX(ctx, tx, update.BlockchainTXID); err != nil { return err } } + // This is a key log line, where we can provide all pieces of correlation data a user needs: + // - The type of the operation + // - The plugin/connector + // - The idempotencyKey + // - The FF Transaction ID + // - The Operation ID + log.L(ctx).Infof("FF_OPERATION_UPDATE: plugin=%s type=%s status=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Plugin, op.Type, update.Status, op.ID, txnIDStr, idempotencyKeyStr) + if handler, ok := ou.manager.handlers[op.Type]; ok { if err := handler.OnOperationUpdate(ctx, op, update); err != nil { return err diff --git a/internal/txwriter/txwriter.go b/internal/txwriter/txwriter.go index 4b68d02bc3..fe2b8c2b7d 100644 --- a/internal/txwriter/txwriter.go +++ b/internal/txwriter/txwriter.go @@ -212,6 +212,14 @@ func (tw *txWriter) processBatch(ctx context.Context, batch *txWriterBatch) erro for _, op := range req.operations { op.Transaction = txn.ID operations = append(operations, op) + + // This is a key log line, where we can provide all pieces of correlation data a user needs: + // - The type of the operation + // - The plugin/connector + // - The idempotencyKey + // - The FF Transaction ID + // - The Operation ID + log.L(ctx).Infof("FF_NEW_TRANSACTION_OPERATION: plugin=%s type=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Plugin, op.Type, op.ID, txn.ID, txn.IdempotencyKey) } } } From bda9be3f01549d126a5dc60a5593df5ad170af4f Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Thu, 11 Dec 2025 12:21:32 -0500 Subject: [PATCH 2/3] Include the namespace Signed-off-by: Peter Broadhurst --- internal/operations/operation_updater.go | 2 +- internal/txwriter/txwriter.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/operations/operation_updater.go b/internal/operations/operation_updater.go index dbab1208c3..68ed8ac265 100644 --- a/internal/operations/operation_updater.go +++ b/internal/operations/operation_updater.go @@ -335,7 +335,7 @@ func (ou *operationUpdater) doUpdate(ctx context.Context, update *core.Operation // - The idempotencyKey // - The FF Transaction ID // - The Operation ID - log.L(ctx).Infof("FF_OPERATION_UPDATE: plugin=%s type=%s status=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Plugin, op.Type, update.Status, op.ID, txnIDStr, idempotencyKeyStr) + log.L(ctx).Infof("FF_OPERATION_UPDATE: namespace=%s plugin=%s type=%s status=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Namespace, op.Plugin, op.Type, update.Status, op.ID, txnIDStr, idempotencyKeyStr) if handler, ok := ou.manager.handlers[op.Type]; ok { if err := handler.OnOperationUpdate(ctx, op, update); err != nil { diff --git a/internal/txwriter/txwriter.go b/internal/txwriter/txwriter.go index fe2b8c2b7d..9367cb6074 100644 --- a/internal/txwriter/txwriter.go +++ b/internal/txwriter/txwriter.go @@ -219,7 +219,7 @@ func (tw *txWriter) processBatch(ctx context.Context, batch *txWriterBatch) erro // - The idempotencyKey // - The FF Transaction ID // - The Operation ID - log.L(ctx).Infof("FF_NEW_TRANSACTION_OPERATION: plugin=%s type=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Plugin, op.Type, op.ID, txn.ID, txn.IdempotencyKey) + log.L(ctx).Infof("FF_NEW_TRANSACTION_OPERATION: namespace=%s plugin=%s type=%s operationId=%s transactionId=%s idempotencyKey='%s'", op.Namespace, op.Plugin, op.Type, op.ID, txn.ID, txn.IdempotencyKey) } } } From b5e0379d3be3503c37be4e4079749bce8a4006a4 Mon Sep 17 00:00:00 2001 From: Enrique Lacal Date: Fri, 12 Dec 2025 00:15:54 +0000 Subject: [PATCH 3/3] fix: nil transaction returned from cache Signed-off-by: Enrique Lacal --- internal/operations/operation_updater.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/operations/operation_updater.go b/internal/operations/operation_updater.go index 68ed8ac265..ed87f67696 100644 --- a/internal/operations/operation_updater.go +++ b/internal/operations/operation_updater.go @@ -270,7 +270,9 @@ func (ou *operationUpdater) doBatchUpdate(ctx context.Context, updates []*core.O if err != nil { return err } - transactions = append(transactions, transaction) + if transaction != nil { + transactions = append(transactions, transaction) + } } }