fetcher span
This commit is contained in:
@@ -30,7 +30,9 @@ func getBaseUrl(country string) string {
|
|||||||
func FetchItem(ctx context.Context, sku string, country string) (*index.DataItem, error) {
|
func FetchItem(ctx context.Context, sku string, country string) (*index.DataItem, error) {
|
||||||
baseUrl := getBaseUrl(country)
|
baseUrl := getBaseUrl(country)
|
||||||
req, err := http.NewRequest("GET", fmt.Sprintf("%s/api/by-sku/%s", baseUrl, sku), nil)
|
req, err := http.NewRequest("GET", fmt.Sprintf("%s/api/by-sku/%s", baseUrl, sku), nil)
|
||||||
req = req.WithContext(ctx)
|
innerCtx, span := tracer.Start(ctx, fmt.Sprintf("fetching data for %s", sku))
|
||||||
|
defer span.End()
|
||||||
|
req = req.WithContext(innerCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user