Skip to content

RoundTripper wraper support for metrics collection#42

Closed
0xMALVEE wants to merge 3 commits intominio:mainfrom
0xMALVEE:optional-roundtipper
Closed

RoundTripper wraper support for metrics collection#42
0xMALVEE wants to merge 3 commits intominio:mainfrom
0xMALVEE:optional-roundtipper

Conversation

@0xMALVEE
Copy link

Comment on lines +53 to +60

// Optional RoundTripper wrapper function. If set, this function
// will be called with the base http.Transport, and should return
// a wrapped RoundTripper (e.g., for metrics collection).
// The wrapper will be inserted between the LoadBalancer and the
// base transport, allowing it to observe all requests with their
// selected endpoints.
WrapRoundTripper func(http.RoundTripper) http.RoundTripper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually you'd do this by providing a custom http.Transport (or even better Roundtripper) for the client to use. Usually that is a more flexible solution to this problem.

@0xMALVEE 0xMALVEE changed the title RoundTripper wraper for metrics collection custom Transport for metrics collection Nov 19, 2025
@0xMALVEE 0xMALVEE changed the title custom Transport for metrics collection custom Transport support for metrics collection Nov 19, 2025
@0xMALVEE 0xMALVEE changed the title custom Transport support for metrics collection custom RoundTripper support for metrics collection Nov 19, 2025
@0xMALVEE 0xMALVEE requested a review from klauspost November 19, 2025 16:28
kms/client.go Outdated
Comment on lines +120 to +121
if conf.Transport != nil {
rt = conf.Transport
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is an issue is that tlsConf is not applied here. You know, maybe just revert what I proposed - it isn't needed here.

Replace the Transport http.RoundTripper field with WrapRoundTripper func
to provide a cleaner API for wrapping the base transport with custom
middleware (metrics, tracing, etc.).

This allows the caller to add functionality without needing to handle
TLS configuration manually.
@0xMALVEE 0xMALVEE requested a review from klauspost November 19, 2025 17:47
@0xMALVEE 0xMALVEE changed the title custom RoundTripper support for metrics collection RoundTripper wraper support for metrics collection Nov 19, 2025
@0xMALVEE
Copy link
Author

closing in favor of #43

@0xMALVEE 0xMALVEE closed this Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants