Skip to content

Commit

Permalink
refactor(checkoutservice): use exception.message key from semantic co…
Browse files Browse the repository at this point in the history
…nvention (open-telemetry#1430)
  • Loading branch information
tranngoclam authored Mar 6, 2024
1 parent 71e428b commit c8b8e08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/checkoutservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"encoding/json"
"fmt"
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"
"net"
"net/http"
"os"
Expand All @@ -16,6 +15,7 @@ import (
"time"

"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"
"go.opentelemetry.io/otel/trace"

"github.com/IBM/sarama"
Expand Down Expand Up @@ -243,7 +243,7 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq
var err error
defer func() {
if err != nil {
span.AddEvent("error", trace.WithAttributes(attribute.String("exception.message", err.Error())))
span.AddEvent("error", trace.WithAttributes(semconv.ExceptionMessageKey.String(err.Error())))
}
}()

Expand Down

0 comments on commit c8b8e08

Please sign in to comment.