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)),