From 6eab783cc005fdfb1db646acef4576d1009624a4 Mon Sep 17 00:00:00 2001 From: Lam Tran Date: Mon, 19 Feb 2024 23:55:10 +0700 Subject: [PATCH] chore: use semantic convention v1.24.0 (#1385) * chore(accountingservice): use semantic convention v1.24.0 * chore(checkoutservice): use semantic convention v1.24.0 --------- Co-authored-by: Austin Parker --- src/accountingservice/kafka/trace_interceptor.go | 8 ++++---- src/checkoutservice/main.go | 7 +++---- 2 files changed, 7 insertions(+), 8 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)), ), diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 91b3c64da3..687b7e307b 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" @@ -502,9 +502,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)),