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 function to create object of confighttp.ClientConfig #6641

Closed
hprajapati-splunk opened this issue Dec 6, 2021 · 17 comments
Labels
closed as inactive good first issue Good for newcomers help wanted Extra attention is needed Stale

Comments

@hprajapati-splunk
Copy link
Contributor

In config/confighttp/confighttp.go file 4 new pointer type variables (MaxIdleConns, MaxIdleConnsPerHost, MaxConnsPerHost, IdleConnTimeout) has been introduced. The pointer type is used in order to distinguish the user provided input with no-input as discussed here.

In long run, we want to change those variable types to non-pointers as discussed here, so we have introduced DefaultHTTPClientSettings functions. Once, all the users' of below two repos start to use DefaultHTTPClientSettings function to create the object of HTTPClientSettings, we'll change those 4 variables's type to non-pointers:

This issue is created to track the progress mentioned above.

@jpkrohling jpkrohling transferred this issue from open-telemetry/opentelemetry-collector Dec 8, 2021
@jpkrohling jpkrohling added the good first issue Good for newcomers label Dec 8, 2021
@jpkrohling
Copy link
Member

@vvydier, this one is also up for grabs, in case you are interested.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2022

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@mattsains
Copy link
Contributor

mattsains commented Nov 14, 2022

I'm working on this issue. I've noticed that a lot of code in contrib defines different timeout values, and a lot of the values are the same across packages, so I'm thinking a lot of the explicit timeout setting is just copy-pasting. Anyway, I'm going to preserve these changes in my PR because I can't know whether these timeouts are intentional or not.

I have a lot of work to do to update all the tests since they mostly assume the timeouts will be set to zero/nil whereas now they are set to the defaults in NewDefaultHTTPClientSettings()

@mattsains
Copy link
Contributor

here's the progress I've made so far. The vast majority of the work is tests, which I'll continue burning through tomorrow:

https://github.com/open-telemetry/opentelemetry-collector-contrib/compare/main...mattsains:opentelemetry-collector-contrib:6641?expand=1

Please let me know if you see any issues with this because I'm repeating the same pattern hundreds of times so it would be good to know earlier if it's wrong :D

@mattsains
Copy link
Contributor

worried about uses of HTTPClientSettings like this one:

confighttp.HTTPClientSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.

I think that results in uninitialized struct values if those values are not present in the config when it is unmarshaled here: https://github.com/open-telemetry/opentelemetry-collector/blob/22d3a4d483e970e01cbc71cfee07df3dcd20dda6/confmap/confmap.go#L114

I'm not really familiar with the code, but would it be reasonable to implement the Unmarshaler interface on DefaultHTTPClientSettings?

povilasv referenced this issue in coralogix/opentelemetry-collector-contrib Dec 19, 2022
@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label Jan 16, 2023
@mattsains
Copy link
Contributor

I think this is still relevant because the config object still exists and there is a path forward to fixing it, just trying to get some buy in before doing the work.

@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label May 29, 2023
@jpkrohling
Copy link
Member

I'm closing this, as it's unlikely to be still relevant. If there's still interest in working on this, please reopen.

@dmitryax dmitryax reopened this Dec 7, 2023
@dmitryax
Copy link
Member

dmitryax commented Dec 7, 2023

This is still relevant

@dmitryax dmitryax added help wanted Extra attention is needed and removed Stale labels Dec 7, 2023
@atoulme
Copy link
Contributor

atoulme commented Dec 14, 2023

$>  git grep -l HTTPClientSettings | xargs dirname | sort | uniq > using_http_client_settings.txt
$> git grep -l DefaultHTTPClientSettings | xargs dirname | sort | uniq > using_default_http_client_settings.txt
$> diff using_http_client_settings.txt using_default_http_client_settings.txt

Gives me:

2,15d1
< cmd/opampsupervisor/specification
< cmd/otelcontribcol
< exporter/alertmanagerexporter
< exporter/datadogexporter
< exporter/dynatraceexporter
< exporter/dynatraceexporter/config
< exporter/elasticsearchexporter
< exporter/f5cloudexporter
< exporter/honeycombmarkerexporter
< exporter/influxdbexporter
< exporter/instanaexporter
< exporter/logicmonitorexporter
< exporter/logzioexporter
< exporter/lokiexporter
18,21d3
< exporter/prometheusremotewriteexporter
< exporter/signalfxexporter
< exporter/signalfxexporter/internal/correlation
< exporter/splunkhecexporter
23,28d4
< exporter/tanzuobservabilityexporter
< exporter/zipkinexporter
< extension/httpforwarder
< extension/oauth2clientauthextension
< extension/observer/ecstaskobserver
< internal/aws/ecsutil
30d5
< processor/resourcedetectionprocessor/internal/aws/ec2
32,51d6
< receiver/apachereceiver
< receiver/apachesparkreceiver
< receiver/awscontainerinsightreceiver/internal/ecsInfo
< receiver/awsecscontainermetricsreceiver
< receiver/bigipreceiver
< receiver/cloudfoundryreceiver
< receiver/couchdbreceiver
< receiver/elasticsearchreceiver
< receiver/expvarreceiver
< receiver/flinkmetricsreceiver
< receiver/gitproviderreceiver/internal/scraper/githubscraper
< receiver/haproxyreceiver
< receiver/httpcheckreceiver
< receiver/nginxreceiver
< receiver/nsxtreceiver
< receiver/purefareceiver
< receiver/purefbreceiver
< receiver/rabbitmqreceiver
< receiver/riakreceiver
< receiver/simpleprometheusreceiver
53d7
< testbed/mockdatasenders/mockdatadogagentexporter

Quite a few components need to change to accomodate that change.

@atoulme
Copy link
Contributor

atoulme commented Dec 14, 2023

Usage to review:

  • cmd/opampsupervisor/specification
  • cmd/otelcontribcol
  • exporter/alertmanagerexporter
  • exporter/datadogexporter
  • exporter/dynatraceexporter
  • exporter/dynatraceexporter/config
  • exporter/elasticsearchexporter
  • exporter/f5cloudexporter
  • exporter/honeycombmarkerexporter
  • exporter/influxdbexporter
  • exporter/instanaexporter
  • exporter/logicmonitorexporter
  • exporter/logzioexporter
  • exporter/lokiexporter
  • exporter/prometheusremotewriteexporter
  • exporter/signalfxexporter
  • exporter/signalfxexporter/internal/correlation
  • exporter/splunkhecexporter
  • exporter/tanzuobservabilityexporter
  • exporter/zipkinexporter
  • extension/httpforwarder
  • extension/oauth2clientauthextension
  • extension/observer/ecstaskobserver
  • internal/aws/ecsutil
  • processor/resourcedetectionprocessor/internal/aws/ec2
  • receiver/apachereceiver
  • receiver/apachesparkreceiver
  • receiver/awscontainerinsightreceiver/internal/ecsInfo
  • receiver/awsecscontainermetricsreceiver
  • receiver/bigipreceiver
  • receiver/cloudfoundryreceiver
  • receiver/couchdbreceiver
  • receiver/elasticsearchreceiver
  • receiver/expvarreceiver
  • receiver/flinkmetricsreceiver
  • receiver/gitproviderreceiver/internal/scraper/githubscraper
  • receiver/haproxyreceiver
  • receiver/httpcheckreceiver
  • receiver/nginxreceiver
  • receiver/nsxtreceiver
  • receiver/purefareceiver
  • receiver/purefbreceiver
  • receiver/rabbitmqreceiver
  • receiver/riakreceiver
  • receiver/simpleprometheusreceiver
  • testbed/mockdatasenders/mockdatadogagentexporter

bogdandrutu pushed a commit that referenced this issue Dec 19, 2023
**Description:**
Modernize the logic of validation by moving to config Validate from the
Start function
Use the HTTPClientDefaultSettings defaults when setting the config.

**Link to tracking Issue:**
#6641

**Testing:**
Updated tests.
bogdandrutu pushed a commit that referenced this issue Dec 21, 2023
**Description:**
Use confighttp.HTTPDefaultClientSettings when configuring the
HTTPClientSettings for the httpforwarder extension.

**Link to tracking Issue:**
#6641
nslaughter pushed a commit to nslaughter/opentelemetry-collector-contrib that referenced this issue Dec 27, 2023
…metry#29931)

**Description:**
Modernize the logic of validation by moving to config Validate from the
Start function
Use the HTTPClientDefaultSettings defaults when setting the config.

**Link to tracking Issue:**
open-telemetry#6641

**Testing:**
Updated tests.
nslaughter pushed a commit to nslaughter/opentelemetry-collector-contrib that referenced this issue Dec 27, 2023
…metry#29887)

**Description:**
Use confighttp.HTTPDefaultClientSettings when configuring the
HTTPClientSettings for the httpforwarder extension.

**Link to tracking Issue:**
open-telemetry#6641
nslaughter pushed a commit to nslaughter/opentelemetry-collector-contrib that referenced this issue Dec 27, 2023
…metry#29931)

**Description:**
Modernize the logic of validation by moving to config Validate from the
Start function
Use the HTTPClientDefaultSettings defaults when setting the config.

**Link to tracking Issue:**
open-telemetry#6641

**Testing:**
Updated tests.
nslaughter pushed a commit to nslaughter/opentelemetry-collector-contrib that referenced this issue Dec 27, 2023
…metry#29887)

**Description:**
Use confighttp.HTTPDefaultClientSettings when configuring the
HTTPClientSettings for the httpforwarder extension.

**Link to tracking Issue:**
open-telemetry#6641
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this issue Jan 10, 2024
…metry#29931)

**Description:**
Modernize the logic of validation by moving to config Validate from the
Start function
Use the HTTPClientDefaultSettings defaults when setting the config.

**Link to tracking Issue:**
open-telemetry#6641

**Testing:**
Updated tests.
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this issue Jan 10, 2024
…metry#29887)

**Description:**
Use confighttp.HTTPDefaultClientSettings when configuring the
HTTPClientSettings for the httpforwarder extension.

**Link to tracking Issue:**
open-telemetry#6641
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label Feb 13, 2024
@andrzej-stencel andrzej-stencel changed the title Use DefaultHTTPClientSettings function to create object of HTTPClientSettings Use confighttp.DefaultClientConfig function to create object of confighttp.ClientConfig Feb 29, 2024
@andrzej-stencel andrzej-stencel changed the title Use confighttp.DefaultClientConfig function to create object of confighttp.ClientConfig Use confighttp.NewDefaultClientConfig function to create object of confighttp.ClientConfig Feb 29, 2024
@andrzej-stencel
Copy link
Member

Here's an example pull request, this one fixes the Sumo Logic exporter: #31510

Similar pull requests are needed for all other components that use the confighttp.ClientConfig{...} initialization.

codeboten pushed a commit that referenced this issue Mar 12, 2024
…Config` (#31510)

Use `confighttp.NewDefaultClientConfig` instead of
`confighttp.ClientConfig{...}`.

**Link to tracking Issue:** #6641

**Testing:**

Unit tests
DougManton pushed a commit to DougManton/opentelemetry-collector-contrib that referenced this issue Mar 13, 2024
…Config` (open-telemetry#31510)

Use `confighttp.NewDefaultClientConfig` instead of
`confighttp.ClientConfig{...}`.

**Link to tracking Issue:** open-telemetry#6641

**Testing:**

Unit tests
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label Apr 30, 2024
Copy link
Contributor

This issue has been closed as inactive because it has been stale for 120 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed as inactive good first issue Good for newcomers help wanted Extra attention is needed Stale
Projects
None yet
Development

No branches or pull requests

7 participants