Skip to content

Commit 6eab783

Browse files
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 <austin@ap2.io>
1 parent e8e3553 commit 6eab783

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/accountingservice/kafka/trace_interceptor.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"go.opentelemetry.io/otel"
1010
"go.opentelemetry.io/otel/attribute"
1111
"go.opentelemetry.io/otel/propagation"
12-
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
12+
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"
1313
"go.opentelemetry.io/otel/trace"
1414

1515
"github.com/IBM/sarama"
@@ -27,9 +27,9 @@ func NewOTelInterceptor(groupID string) *OTelInterceptor {
2727
oi.tracer = otel.Tracer("github.com/open-telemetry/opentelemetry-demo/accountingservice/sarama")
2828

2929
oi.fixedAttrs = []attribute.KeyValue{
30-
semconv.MessagingSystem("kafka"),
30+
semconv.MessagingSystemKafka,
3131
semconv.MessagingKafkaConsumerGroup(groupID),
32-
semconv.NetTransportTCP,
32+
semconv.NetworkTransportTCP,
3333
}
3434
return &oi
3535
}
@@ -52,7 +52,7 @@ func (oi *OTelInterceptor) OnConsume(msg *sarama.ConsumerMessage) {
5252
trace.WithAttributes(
5353
semconv.MessagingDestinationName(msg.Topic),
5454
semconv.MessagingKafkaMessageOffset(int(msg.Offset)),
55-
semconv.MessagingMessagePayloadSizeBytes(len(msg.Value)),
55+
semconv.MessagingMessageBodySize(len(msg.Value)),
5656
semconv.MessagingOperationReceive,
5757
semconv.MessagingKafkaDestinationPartition(int(msg.Partition)),
5858
),

src/checkoutservice/main.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"context"
88
"encoding/json"
99
"fmt"
10-
semconv "go.opentelemetry.io/otel/semconv/v1.19.0"
10+
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"
1111
"net"
1212
"net/http"
1313
"os"
@@ -502,9 +502,8 @@ func createProducerSpan(ctx context.Context, msg *sarama.ProducerMessage) trace.
502502
trace.WithSpanKind(trace.SpanKindProducer),
503503
trace.WithAttributes(
504504
semconv.PeerService("kafka"),
505-
semconv.NetTransportTCP,
506-
semconv.MessagingSystem("kafka"),
507-
semconv.MessagingDestinationKindTopic,
505+
semconv.NetworkTransportTCP,
506+
semconv.MessagingSystemKafka,
508507
semconv.MessagingDestinationName(msg.Topic),
509508
semconv.MessagingOperationPublish,
510509
semconv.MessagingKafkaDestinationPartition(int(msg.Partition)),

0 commit comments

Comments
 (0)