open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
4.43k stars 1.46k forks source link

[confighttp] Add max_redirects configuration option #10870

Open rogercoll opened 2 months ago

rogercoll commented 2 months ago

Is your feature request related to a problem? Please describe.

Components that use the confighttp to initialize an HTTP Client are not able to define the maximum number of redirection the client should perform. The provided client uses the default CheckRedirect http configuration:

// If CheckRedirect is nil, the Client uses its default policy, // which is to stop after 10 consecutive requests.

Use case: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34623

Describe the solution you'd like

Configuration option to limit the number of redirections, if non provided, the client should continue to work as it is (default redirections)

endpoint: otelcol2:55690
    auth:
      authenticator: some-authenticator-extension
...
max_redirects: 0
rogercoll commented 2 months ago

PoC: https://github.com/open-telemetry/opentelemetry-collector/pull/10877