mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 10:00:44 -05:00
The disco.Disco API isn't yet set up to pass through context.Context, and so if we give it a HTTP client that has the OpenTelemetry instrumentation on it then any HTTP request causes an orphan trace span disconnected from the main trace, which causes annoying noise in some trace viewers. As a temporary solution so we can ship v1.10 soon without making large changes to the svchost library, we'll prevent the HTTP client constructor function from detecting that tracing is enabled by passing it context.TODO() instead of the actual context. This would not be acceptable in the long run but is safe for this temporary workaround because currently httpclient.New doesn't use the given context for anything except detecting whether tracing is enabled. We will address this in a more complete way during the v1.11 development period by modernizing svchost to take context.Context arguments on all functions that can potentially make external requests. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>