Skip to content

Commit

Permalink
chore: use semantic convention v1.24.0 (open-telemetry#1385)
Browse files Browse the repository at this point in the history
* chore(accountingservice): use semantic convention v1.24.0

* chore(checkoutservice): use semantic convention v1.24.0

---------

Co-authored-by: Austin Parker <[email protected]>
  • Loading branch information
tranngoclam and austinlparker authored Feb 19, 2024
1 parent 3946a20 commit c99589b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/accountingservice/kafka/trace_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand All @@ -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)),
),
Expand Down
7 changes: 3 additions & 4 deletions src/checkoutservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)),
Expand Down

0 comments on commit c99589b

Please sign in to comment.