From c28b8a9750e4188b0466b440c6b745d4db88d50a Mon Sep 17 00:00:00 2001 From: Jake Schuurmans Date: Wed, 11 Oct 2023 09:01:18 -0400 Subject: [PATCH 1/2] Adding conditionKind values to traces --- internal/worker/worker.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/worker/worker.go b/internal/worker/worker.go index 2daf1bf3..a8859d09 100644 --- a/internal/worker/worker.go +++ b/internal/worker/worker.go @@ -23,6 +23,7 @@ import ( "go.hollow.sh/toolbox/events/pkg/kv" "go.hollow.sh/toolbox/events/registry" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" cpv1types "github.com/metal-toolbox/conditionorc/pkg/api/v1/types" @@ -268,9 +269,13 @@ func (o *Worker) processSingleEvent(ctx context.Context, e events.Message) { o.registerEventCounter(false, "ack") o.eventAckComplete(e) + span.SetAttributes(attribute.KeyValue{Key: "conditionKind", Value: attribute.StringValue("nil")}) + return } + span.SetAttributes(attribute.KeyValue{Key: "conditionKind", Value: attribute.StringValue(condition.ID.String())}) + // check and see if the task is or has-been handled by another worker currentState := o.taskInProgress(condition.ID.String()) switch currentState { From e66cd7facefa41766e1d7e319e5f2361ef56d88e Mon Sep 17 00:00:00 2001 From: Jake Schuurmans Date: Wed, 11 Oct 2023 11:55:51 -0400 Subject: [PATCH 2/2] remove error path --- internal/worker/worker.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/worker/worker.go b/internal/worker/worker.go index a8859d09..ec1fd776 100644 --- a/internal/worker/worker.go +++ b/internal/worker/worker.go @@ -269,8 +269,6 @@ func (o *Worker) processSingleEvent(ctx context.Context, e events.Message) { o.registerEventCounter(false, "ack") o.eventAckComplete(e) - span.SetAttributes(attribute.KeyValue{Key: "conditionKind", Value: attribute.StringValue("nil")}) - return }