Is your feature request related to a problem? Please describe.
cloud.google.com/go/compute/metadata API does have a way to make propagage a context to http requests. This means a context cannot be used to control RPC lifetime and that when open telemetry is used the requests from the metadata client are not associated with the parent span.
Describe the solution you'd like
Perhaps the package *WithContext variants of the existing functions could be added that allow passing in a request context.
Describe alternatives you've considered
Additional context
I'm able to attach tracing to the package by using the go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp package, but traces are not associated with parent spans.
hc := &http.Client{
Transport: otelhttp.NewTransport(&http.Transport{
Dial: (&net.Dialer{
Timeout: 2 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
}),
Timeout: 60 * time.Second,
}
mc := metadata.NewClient(hc)
Is your feature request related to a problem? Please describe.
cloud.google.com/go/compute/metadataAPI does have a way to make propagage a context tohttprequests. This means a context cannot be used to control RPC lifetime and that when open telemetry is used the requests from themetadataclient are not associated with the parent span.Describe the solution you'd like
Perhaps the package
*WithContextvariants of the existing functions could be added that allow passing in a request context.Describe alternatives you've considered
Additional context
I'm able to attach tracing to the package by using the
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttppackage, but traces are not associated with parent spans.