Skip to content

Commit

Permalink
Merge pull request #94 from honeycombio/howardyoo-patch-3
Browse files Browse the repository at this point in the history
Add content of orderItems in checkout
  • Loading branch information
howardyoo authored Oct 7, 2024
2 parents ae64b77 + 745ed26 commit 31aff20
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/checkoutservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ package main
import (
"context"
"fmt"
"math"
"math/rand"
"net"
"os"
"strconv"
"time"

"github.com/google/uuid"
pb "github.com/honeycombio/microservices-demo/src/checkoutservice/demo/msdemo"
"github.com/honeycombio/microservices-demo/src/checkoutservice/money"
Expand All @@ -23,12 +30,6 @@ import (
"google.golang.org/grpc/credentials/insecure"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/status"
"math"
"math/rand"
"net"
"os"
"strconv"
"time"
)

const (
Expand Down Expand Up @@ -309,10 +310,12 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq
if err != nil {
return nil, status.Errorf(codes.Unavailable, "shipping error: %+v", err)
}

span.AddEvent("shipped", trace.WithAttributes(
orderIDKey.String(orderID.String()),
userIDKey.String(userID),
attribute.Int("itemCount", len(prep.cartItems)),
attribute.String("orderItems", fmt.Sprintf("%+v", prep.orderItems)),
))

orderResult := &pb.OrderResult{
Expand Down

0 comments on commit 31aff20

Please sign in to comment.