machinebox / graphql

Simple low-level GraphQL HTTP client for Go
https://blog.machinebox.io/a-graphql-client-library-for-go-5bffd0455878
Apache License 2.0
933 stars 217 forks source link

OpenTelemetry info can't transfer to the called api #75

Closed wamdy closed 1 year ago

wamdy commented 1 year ago

OpenTelemetry info can't transfer to the called api,I hav filled the ctx on client.Run(ctx, req, &result)

wamdy commented 1 year ago

I think I sloved it. defaultClient := http.DefaultClient defaultClient.Transport = otelhttp.NewTransport( http.DefaultTransport, otelhttp.WithPropagators(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation. Baggage{})), ) opt:= graphql.WithHTTPClient(defaultClient) client := graphql.NewClient(url,opt)