Skip to content

Consider HTTPClient to support RoundTripper #3149

@ivankatliarchuk

Description

@ivankatliarchuk

Describe the feature

Currently, AWS SDK configuration offers two HTTP client options: using the default BuildableClient or providing a custom http.Client. The latter, however, often lacks out-of-the-box support for key AWS features like AWS_CA_BUNDLE, that only works if HttpClient is of BuildableClient type, often forcing users to replicate complex SDK logic or use library specific midleware. Nothing wrong with the approach itself.

We propose direct http.RoundTripper support, similar to how Kubernetes (client-go) and OpenTelemetry (otelhttp) integrate it. This would enable a cleaner extensibility model, for example, via a NewBuildableClient().WrapperFunc(func(rt http.RoundTripper) {})... method.

The proposal is to support RoundTripper, examples

  1. kubernetes https://github.com/kubernetes/client-go/blob/ec5b832e6085a572b8c325dafe9323ff18174732/rest/config.go#L107
  2. opentelemetry https://github.com/open-telemetry/opentelemetry-go-contrib/blob/caee80916a50f168c7152967dabaefd0c3cd17c0/instrumentation/net/http/otelhttp/transport.go#L26

Use Case

In external-dns for example we instrumenting HTTP requests with project specific metrics, traces that do require capturing request/response statistics. AWS SDK library we could not instrument it with RoundTripper pattern, which is quite different to other providers, and sdk middleware instrumentation is required.

Other use cases

Proposed Solution

Re-use kubernetes or opentelemetry approach with RoundTripper

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Go SDK V2 Module Versions Used

v1.36.6

Go version used

1.24

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions