Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use confighttp.NewDefaultClientConfig instead of manually creating struct #11274

Closed
1 task done
mackjmr opened this issue Sep 25, 2024 · 2 comments
Closed
1 task done

Comments

@mackjmr
Copy link
Member

mackjmr commented Sep 25, 2024

Related to second point in: #9478 (comment).

Move away from manually creating confighttp.ClientConfig in favor of using confighttp.NewDefaultClientConfig.

This is necessary for the following components:

This will be done following conditions:

  • Fields that are currently different than the default will be updated after call to NewDefaultClientConfig
  • Fields that are same as default will not be set manually anymore
  • Fields that are set in the default but currently unset in above components will be either manually unset (for backwards compatibility) or will be updated to match default.

For the third point, I am unsure of which approach to follow. An example is the otlphttpexporter (#11273), where previously MaxIdleConns, MaxIdleConnsPerHost, MaxConnsPerHost and IdleConnTimeout were unset (equivalent of nil), which is different than the default which has values.

bogdandrutu pushed a commit that referenced this issue Sep 26, 2024
…ually creating struct (#11273)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes usage of `NewDefaultClientConfig` instead of manually
creating the `confighttp.ClientConfig` struct. The updates to defaults
are maintained (Timeout, Compression, WriteBufferSize) whereas the
fields that match the default are not manually set anymore (Endpoint,
Headers).

It also sets to nil the fields that are set in default but weren't set
previously (MaxIdleConns, MaxIdleConnsPerHost, MaxConnsPerHost,
IdleConnTimeout) to retain the same behaviour. I am on the fence about
this one, should we switch to using the defaults ?

<!-- Issue number if applicable -->
#### Link to tracking issue
#11274

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->
@bogdandrutu
Copy link
Member

Can you please separate this into 2 different issues: one for core components and one for contrib?

@mackjmr
Copy link
Member Author

mackjmr commented Sep 27, 2024

Opened following issue for contrib: open-telemetry/opentelemetry-collector-contrib#35457

@mackjmr mackjmr closed this as completed Sep 27, 2024
jackgopack4 pushed a commit to jackgopack4/opentelemetry-collector that referenced this issue Oct 8, 2024
…ually creating struct (open-telemetry#11273)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes usage of `NewDefaultClientConfig` instead of manually
creating the `confighttp.ClientConfig` struct. The updates to defaults
are maintained (Timeout, Compression, WriteBufferSize) whereas the
fields that match the default are not manually set anymore (Endpoint,
Headers).

It also sets to nil the fields that are set in default but weren't set
previously (MaxIdleConns, MaxIdleConnsPerHost, MaxConnsPerHost,
IdleConnTimeout) to retain the same behaviour. I am on the fence about
this one, should we switch to using the defaults ?

<!-- Issue number if applicable -->
#### Link to tracking issue
open-telemetry#11274

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->
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

No branches or pull requests

2 participants