Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ exclude = [
"^https://platform\\.openai\\.com",
# Cloudflare-protected, returns 503 to bots
"^https://coralogix\\.com/",
"^https://community\\.splunk\\.com/",
]

exclude_path = [
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ the release.

## Unreleased

* [checkout] Add gRPC retry policy to checkout service client ([#417](https://github.com/nudgebee/opentelemetry-demo/pull/417))

* [recommendation] Fix `recommendationCacheFailure` feature flag by
using `ListProducts` instead of `GetProduct`
([#3260](https://github.com/open-telemetry/opentelemetry-demo/pull/3260))
Expand Down
19 changes: 16 additions & 3 deletions src/checkout/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (cs *checkout) PlaceOrder(ctx context.Context, req *pb.PlaceOrderRequest) (

prep, err := cs.prepareOrderItemsAndShippingQuoteFromCart(ctx, req.UserId, req.UserCurrency, req.Address)
if err != nil {
return nil, status.Errorf(codes.Internal, err.Error())
return nil, status.Errorf(codes.Internal, "%s", err.Error())
}
span.AddEvent("prepared")

Expand Down Expand Up @@ -444,14 +444,27 @@ func (cs *checkout) prepareOrderItemsAndShippingQuoteFromCart(ctx context.Contex
}

func mustCreateClient(svcAddr string) *grpc.ClientConn {
retryPolicy := `{
"methodConfig": [{
"name": [{"service": ""}],
"waitForReady": true,
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "0.1s",
"maxBackoff": "1s",
"backoffMultiplier": 2,
"retryableStatusCodes": [ "UNAVAILABLE" ]
}
}]
}`
c, err := grpc.NewClient(svcAddr,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithStatsHandler(otelgrpc.NewClientHandler()),
grpc.WithDefaultServiceConfig(retryPolicy),
)
if err != nil {
logger.Error(fmt.Sprintf("could not connect to %s service, err: %+v", svcAddr, err))
panic(err)
}

return c
}

Expand Down
Loading