Skip to content

Commit

Permalink
[exporter/splunkhec] set a default of 10s for idle connection timeout (
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Apr 6, 2023
1 parent dafb802 commit e89cc46
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .chloggen/allow-to-configure-idle-conn-timeout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Set the default value of the idle connection timeout to 10s, rather than 30s by default

# One or more tracking issues related to the change
issues: [20543]

# (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:
2 changes: 2 additions & 0 deletions exporter/splunkhecexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestLoadConfig(t *testing.T) {
defaultCfg.HTTPClientSettings.Endpoint = "https://splunk:8088/services/collector"

hundred := 100
idleConnTimeout := 10 * time.Second

tests := []struct {
id component.ID
Expand Down Expand Up @@ -80,6 +81,7 @@ func TestLoadConfig(t *testing.T) {
},
MaxIdleConns: &hundred,
MaxIdleConnsPerHost: &hundred,
IdleConnTimeout: &idleConnTimeout,
},
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
Expand Down
11 changes: 7 additions & 4 deletions exporter/splunkhecexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ import (

const (
// The value of "type" key in configuration.
typeStr = "splunk_hec"
defaultMaxIdleCons = 100
defaultHTTPTimeout = 10 * time.Second
defaultSplunkAppName = "OpenTelemetry Collector Contrib"
typeStr = "splunk_hec"
defaultMaxIdleCons = 100
defaultHTTPTimeout = 10 * time.Second
defaultIdleConnTimeout = 10 * time.Second
defaultSplunkAppName = "OpenTelemetry Collector Contrib"
)

// TODO: Find a place for this to be shared.
Expand All @@ -62,11 +63,13 @@ func NewFactory() exporter.Factory {

func createDefaultConfig() component.Config {
defaultMaxConns := defaultMaxIdleCons
defaultIdleConnTimeout := defaultIdleConnTimeout
return &Config{
LogDataEnabled: true,
ProfilingDataEnabled: true,
HTTPClientSettings: confighttp.HTTPClientSettings{
Timeout: defaultHTTPTimeout,
IdleConnTimeout: &defaultIdleConnTimeout,
MaxIdleConnsPerHost: &defaultMaxConns,
MaxIdleConns: &defaultMaxConns,
},
Expand Down

0 comments on commit e89cc46

Please sign in to comment.