WrapWithOTel returns rt wrapped with otelhttp when OpenTelemetry has been enabled via `SetOTelEnabled` (called by `initOTelSDK`), or rt unchanged otherwise. Gating avoids per-request span allocation on the no-OTel path and stops sending a `traceparent` header to upstream LLM providers that have no u
(rt http.RoundTripper)
| 80 | // that build their own transports outside of `NewHTTPClient` can opt |
| 81 | // into the same gating without duplicating the check. |
| 82 | func WrapWithOTel(rt http.RoundTripper) http.RoundTripper { |
| 83 | if !otelEnabled.Load() { |
| 84 | return rt |
| 85 | } |
| 86 | return otelhttp.NewTransport(rt) |
| 87 | } |
| 88 | |
| 89 | // TracedDefaultClient returns an `http.Client` equivalent to |
| 90 | // `http.DefaultClient` but with the default transport wrapped via |
no test coverage detected