From cacf1b9774a7b18f48332c6e6ad4f919b513b204 Mon Sep 17 00:00:00 2001 From: Lam Tran Date: Mon, 4 Mar 2024 21:20:08 +0700 Subject: [PATCH] refactor(checkoutservice): use exception.message key from semantic convention --- src/checkoutservice/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 687b7e307b..9febb26109 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -7,7 +7,6 @@ import ( "context" "encoding/json" "fmt" - semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "net" "net/http" "os" @@ -16,6 +15,7 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" "github.com/IBM/sarama" @@ -243,7 +243,7 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq var err error defer func() { if err != nil { - span.AddEvent("error", trace.WithAttributes(attribute.String("exception.message", err.Error()))) + span.AddEvent("error", trace.WithAttributes(semconv.ExceptionMessageKey.String(err.Error()))) } }()