From e0c16757173304bff1c20eb9f1c3fd8b923f54a6 Mon Sep 17 00:00:00 2001 From: Lam Tran Date: Sun, 18 Feb 2024 15:53:54 +0700 Subject: [PATCH 1/2] chore(accountingservice): use semantic convention v1.24.0 --- src/accountingservice/kafka/trace_interceptor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/accountingservice/kafka/trace_interceptor.go b/src/accountingservice/kafka/trace_interceptor.go index 44110a5c17..16899a5891 100644 --- a/src/accountingservice/kafka/trace_interceptor.go +++ b/src/accountingservice/kafka/trace_interceptor.go @@ -9,7 +9,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" "github.com/IBM/sarama" @@ -27,9 +27,9 @@ func NewOTelInterceptor(groupID string) *OTelInterceptor { oi.tracer = otel.Tracer("github.com/open-telemetry/opentelemetry-demo/accountingservice/sarama") oi.fixedAttrs = []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), + semconv.MessagingSystemKafka, semconv.MessagingKafkaConsumerGroup(groupID), - semconv.NetTransportTCP, + semconv.NetworkTransportTCP, } return &oi } @@ -52,7 +52,7 @@ func (oi *OTelInterceptor) OnConsume(msg *sarama.ConsumerMessage) { trace.WithAttributes( semconv.MessagingDestinationName(msg.Topic), semconv.MessagingKafkaMessageOffset(int(msg.Offset)), - semconv.MessagingMessagePayloadSizeBytes(len(msg.Value)), + semconv.MessagingMessageBodySize(len(msg.Value)), semconv.MessagingOperationReceive, semconv.MessagingKafkaDestinationPartition(int(msg.Partition)), ), From 182f21c75de1773db691066b0f037f938c494e1e Mon Sep 17 00:00:00 2001 From: Lam Tran Date: Sun, 18 Feb 2024 16:55:57 +0700 Subject: [PATCH 2/2] chore(checkoutservice): use semantic convention v1.24.0 --- src/checkoutservice/main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index b06bd44c0a..2f5250b481 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -7,7 +7,7 @@ import ( "context" "encoding/json" "fmt" - semconv "go.opentelemetry.io/otel/semconv/v1.19.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "net" "net/http" "os" @@ -507,9 +507,8 @@ func createProducerSpan(ctx context.Context, msg *sarama.ProducerMessage) trace. trace.WithSpanKind(trace.SpanKindProducer), trace.WithAttributes( semconv.PeerService("kafka"), - semconv.NetTransportTCP, - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, + semconv.NetworkTransportTCP, + semconv.MessagingSystemKafka, semconv.MessagingDestinationName(msg.Topic), semconv.MessagingOperationPublish, semconv.MessagingKafkaDestinationPartition(int(msg.Partition)),