Skip to content

Commit 4c1f214

Browse files
authored
update to NewClient call (open-telemetry#1688)
1 parent 86d33a3 commit 4c1f214

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/checkoutservice/main.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,32 +168,32 @@ func main() {
168168
svc := new(checkoutService)
169169

170170
mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR")
171-
c := mustCreateClient(context.Background(), svc.shippingSvcAddr)
171+
c := mustCreateClient(svc.shippingSvcAddr)
172172
svc.shippingSvcClient = pb.NewShippingServiceClient(c)
173173
defer c.Close()
174174

175175
mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_SERVICE_ADDR")
176-
c = mustCreateClient(context.Background(), svc.productCatalogSvcAddr)
176+
c = mustCreateClient(svc.productCatalogSvcAddr)
177177
svc.productCatalogSvcClient = pb.NewProductCatalogServiceClient(c)
178178
defer c.Close()
179179

180180
mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR")
181-
c = mustCreateClient(context.Background(), svc.cartSvcAddr)
181+
c = mustCreateClient(svc.cartSvcAddr)
182182
svc.cartSvcClient = pb.NewCartServiceClient(c)
183183
defer c.Close()
184184

185185
mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR")
186-
c = mustCreateClient(context.Background(), svc.currencySvcAddr)
186+
c = mustCreateClient(svc.currencySvcAddr)
187187
svc.currencySvcClient = pb.NewCurrencyServiceClient(c)
188188
defer c.Close()
189189

190190
mustMapEnv(&svc.emailSvcAddr, "EMAIL_SERVICE_ADDR")
191-
c = mustCreateClient(context.Background(), svc.emailSvcAddr)
191+
c = mustCreateClient(svc.emailSvcAddr)
192192
svc.emailSvcClient = pb.NewEmailServiceClient(c)
193193
defer c.Close()
194194

195195
mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_SERVICE_ADDR")
196-
c = mustCreateClient(context.Background(), svc.paymentSvcAddr)
196+
c = mustCreateClient(svc.paymentSvcAddr)
197197
svc.paymentSvcClient = pb.NewPaymentServiceClient(c)
198198
defer c.Close()
199199

@@ -373,8 +373,8 @@ func (cs *checkoutService) prepareOrderItemsAndShippingQuoteFromCart(ctx context
373373
return out, nil
374374
}
375375

376-
func mustCreateClient(ctx context.Context, svcAddr string) *grpc.ClientConn {
377-
c, err := grpc.DialContext(ctx, svcAddr,
376+
func mustCreateClient(svcAddr string) *grpc.ClientConn {
377+
c, err := grpc.NewClient(svcAddr,
378378
grpc.WithTransportCredentials(insecure.NewCredentials()),
379379
grpc.WithStatsHandler(otelgrpc.NewClientHandler()),
380380
)
@@ -444,7 +444,7 @@ func (cs *checkoutService) chargeCard(ctx context.Context, amount *pb.Money, pay
444444
paymentService := cs.paymentSvcClient
445445
if cs.isFeatureFlagEnabled(ctx, "paymentServiceUnreachable") {
446446
badAddress := "badAddress:50051"
447-
c := mustCreateClient(context.Background(), badAddress)
447+
c := mustCreateClient(badAddress)
448448
paymentService = pb.NewPaymentServiceClient(c)
449449
}
450450

0 commit comments

Comments
 (0)