Skip to content

Commit

Permalink
[extension/httpforwarder] use default http client settings (open-tele…
Browse files Browse the repository at this point in the history
…metry#29887)

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

**Link to tracking Issue:**
open-telemetry#6641
  • Loading branch information
atoulme authored and cparkins committed Jan 10, 2024
1 parent 5b9aafd commit d3ce180
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .chloggen/httpforwarder_use_default_http_client_settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: httpforwarder

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Use confighttp.HTTPDefaultClientSettings when configuring the HTTPClientSettings for the httpforwarder extension.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [6641]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
By default, the HTTP forwarder extension will now use the defaults set in the extension:
* The idle connection timeout is set to 90s.
* The max idle connection count is set to 100.
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
6 changes: 5 additions & 1 deletion extension/httpforwarder/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (

func TestLoadConfig(t *testing.T) {
t.Parallel()
maxIdleConns := 42
idleConnTimeout := 80 * time.Second

tests := []struct {
id component.ID
Expand All @@ -40,7 +42,9 @@ func TestLoadConfig(t *testing.T) {
Headers: map[string]configopaque.String{
"otel_http_forwarder": "dev",
},
Timeout: 5 * time.Second,
MaxIdleConns: &maxIdleConns,
IdleConnTimeout: &idleConnTimeout,
Timeout: 5 * time.Second,
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions extension/httpforwarder/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ func NewFactory() extension.Factory {
}

func createDefaultConfig() component.Config {
httpClientSettings := confighttp.NewDefaultHTTPClientSettings()
httpClientSettings.Timeout = 10 * time.Second
return &Config{
Ingress: confighttp.HTTPServerSettings{
Endpoint: defaultEndpoint,
},
Egress: confighttp.HTTPClientSettings{
Timeout: 10 * time.Second,
},
Egress: httpClientSettings,
}
}

Expand Down
2 changes: 2 additions & 0 deletions extension/httpforwarder/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ http_forwarder/1:
endpoint: http://target/
headers:
otel_http_forwarder: dev
idle_conn_timeout: 80s
max_idle_conns: 42
timeout: 5s

0 comments on commit d3ce180

Please sign in to comment.