config: apply DialContextFunc to OAuth2 token-fetch transport (#911) newOauth2TokenSource builds its own http.Transport to fetch tokens but doesn't set DialContext on it. Any DialContextFunc passed via WithDialContextFunc is applied to the main request transport but silently skipped for the token endpoint. Set DialContext on the token transport the same way it is set on the main one. When dialContextFunc is nil the behaviour is unchanged since http.Transport falls back to its default dialer. Added TestOAuth2DialContextFunc to verify that WithDialContextFunc blocks the token endpoint fetch, not only the final request. Signed-off-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
This repository contains Go libraries that are shared across Prometheus components and libraries. They are considered internal to Prometheus, without any stability guarantees for external usage.
context.Context