From e36845c09a6a6864915dd4b4b026f1c8e1fcae6a Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Mon, 16 Oct 2023 11:10:12 -0700 Subject: [PATCH] [exporter/signalfx] [exporter/splunkhec] Remove max_connections config parameter (#27611) **Description:** The max_connections config setting were deprecated with https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16837 and https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16838. It has been 10 months since these changes have been made and it is time to remove this configuration setting altogether. **Link to tracking Issue:** #27610 --- ...ove-max-connections-splunkhecexporter.yaml | 28 +++++++++++++++++++ .chloggen/remove-max-connections.yaml | 28 +++++++++++++++++++ exporter/signalfxexporter/config.go | 8 ------ exporter/signalfxexporter/config_test.go | 8 ------ exporter/signalfxexporter/exporter.go | 10 ------- exporter/splunkhecexporter/README.md | 1 - exporter/splunkhecexporter/client.go | 10 ------- exporter/splunkhecexporter/config.go | 4 --- .../example/otel-collector-config.yml | 2 -- 9 files changed, 56 insertions(+), 43 deletions(-) create mode 100644 .chloggen/remove-max-connections-splunkhecexporter.yaml create mode 100644 .chloggen/remove-max-connections.yaml diff --git a/.chloggen/remove-max-connections-splunkhecexporter.yaml b/.chloggen/remove-max-connections-splunkhecexporter.yaml new file mode 100644 index 000000000000..9fbc48096192 --- /dev/null +++ b/.chloggen/remove-max-connections-splunkhecexporter.yaml @@ -0,0 +1,28 @@ +# 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: splunkhecexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Remove `max_connections` configuration setting. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [27610] + +# (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: | + use max_idle_conns or max_idle_conns_per_host instead. + +# 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: [] diff --git a/.chloggen/remove-max-connections.yaml b/.chloggen/remove-max-connections.yaml new file mode 100644 index 000000000000..3c005a0a937d --- /dev/null +++ b/.chloggen/remove-max-connections.yaml @@ -0,0 +1,28 @@ +# 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: signalfxexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Remove `max_connections` configuration setting. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [27610] + +# (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: | + use max_idle_conns or max_idle_conns_per_host instead. + +# 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: [] diff --git a/exporter/signalfxexporter/config.go b/exporter/signalfxexporter/config.go index d75aa6d174fa..5c10373186d1 100644 --- a/exporter/signalfxexporter/config.go +++ b/exporter/signalfxexporter/config.go @@ -130,10 +130,6 @@ type Config struct { // to be used in a dimension key. NonAlphanumericDimensionChars string `mapstructure:"nonalphanumeric_dimension_chars"` - // MaxConnections is used to set a limit to the maximum idle HTTP connection the exporter can keep open. - // Deprecated: use HTTPClientSettings.MaxIdleConns or HTTPClientSettings.MaxIdleConnsPerHost instead. - MaxConnections int `mapstructure:"max_connections"` - // Whether to drop histogram bucket metrics dispatched to Splunk Observability. // Default value is set to false. DropHistogramBuckets bool `mapstructure:"drop_histogram_buckets"` @@ -226,10 +222,6 @@ func (cfg *Config) Validate() error { return errors.New(`cannot have a negative "timeout"`) } - if cfg.MaxConnections < 0 { - return errors.New(`cannot have a negative "max_connections"`) - } - return nil } diff --git a/exporter/signalfxexporter/config_test.go b/exporter/signalfxexporter/config_test.go index 94bcc6acf8e6..fae9ae2d5c67 100644 --- a/exporter/signalfxexporter/config_test.go +++ b/exporter/signalfxexporter/config_test.go @@ -484,14 +484,6 @@ func TestConfigValidateErrors(t *testing.T) { APIURL: "https://api.us1.signalfx.com/", }, }, - { - name: "Negative MaxConnections", - cfg: &Config{ - Realm: "us0", - AccessToken: "access_token", - MaxConnections: -1, - }, - }, { name: "Negative Timeout", cfg: &Config{ diff --git a/exporter/signalfxexporter/exporter.go b/exporter/signalfxexporter/exporter.go index 211573243c9c..9826a8293e76 100644 --- a/exporter/signalfxexporter/exporter.go +++ b/exporter/signalfxexporter/exporter.go @@ -212,16 +212,6 @@ func (se *signalfxExporter) startLogs(_ context.Context, host component.Host) er func (se *signalfxExporter) createClient(host component.Host) (*http.Client, error) { se.config.HTTPClientSettings.TLSSetting = se.config.IngestTLSSettings - if se.config.MaxConnections != 0 && (se.config.MaxIdleConns == nil || se.config.HTTPClientSettings.MaxIdleConnsPerHost == nil) { - se.logger.Warn("You are using the deprecated `max_connections` option that will be removed soon; use `max_idle_conns` and/or `max_idle_conns_per_host` instead: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/signalfxexporter#advanced-configuration") - if se.config.HTTPClientSettings.MaxIdleConns == nil { - se.config.HTTPClientSettings.MaxIdleConns = &se.config.MaxConnections - } - if se.config.HTTPClientSettings.MaxIdleConnsPerHost == nil { - se.config.HTTPClientSettings.MaxIdleConnsPerHost = &se.config.MaxConnections - } - } - return se.config.ToClient(host, se.telemetrySettings) } diff --git a/exporter/splunkhecexporter/README.md b/exporter/splunkhecexporter/README.md index d77714025b5c..e9991e0ada66 100644 --- a/exporter/splunkhecexporter/README.md +++ b/exporter/splunkhecexporter/README.md @@ -26,7 +26,6 @@ The following configuration options can also be configured: - `source` (no default): Optional Splunk source: https://docs.splunk.com/Splexicon:Source - `sourcetype` (no default): Optional Splunk source type: https://docs.splunk.com/Splexicon:Sourcetype - `index` (no default): Splunk index, optional name of the Splunk index targeted -- `max_connections` (default: 100): Maximum HTTP connections to use simultaneously when sending data. Deprecated: use `max_idle_conns` or `max_idle_conns_per_host` instead. See [HTTP settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/confighttp/README.md) for more info. - `use_multi_metric_format` (default: false): Combines metrics with the same metadata to reduce ingest using the [multiple-metric JSON format](https://docs.splunk.com/Documentation/Splunk/9.0.0/Metrics/GetMetricsInOther#The_multiple-metric_JSON_format). Applicable in the `metrics` pipeline only. - `disable_compression` (default: false): Whether to disable gzip compression over HTTP. - `timeout` (default: 10s): HTTP timeout when sending data. diff --git a/exporter/splunkhecexporter/client.go b/exporter/splunkhecexporter/client.go index 6a9beaebd289..89432fde233e 100644 --- a/exporter/splunkhecexporter/client.go +++ b/exporter/splunkhecexporter/client.go @@ -664,16 +664,6 @@ func checkHecHealth(ctx context.Context, client *http.Client, healthCheckURL *ur func buildHTTPClient(config *Config, host component.Host, telemetrySettings component.TelemetrySettings) (*http.Client, error) { // we handle compression explicitly. config.HTTPClientSettings.Compression = "" - if config.MaxConnections != 0 && (config.MaxIdleConns == nil || config.HTTPClientSettings.MaxIdleConnsPerHost == nil) { - telemetrySettings.Logger.Warn("You are using the deprecated `max_connections` option that will be removed soon; use `max_idle_conns` and/or `max_idle_conns_per_host` instead: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/splunkhecexporter#advanced-configuration") - intMaxConns := int(config.MaxConnections) - if config.HTTPClientSettings.MaxIdleConns == nil { - config.HTTPClientSettings.MaxIdleConns = &intMaxConns - } - if config.HTTPClientSettings.MaxIdleConnsPerHost == nil { - config.HTTPClientSettings.MaxIdleConnsPerHost = &intMaxConns - } - } return config.ToClient(host, telemetrySettings) } diff --git a/exporter/splunkhecexporter/config.go b/exporter/splunkhecexporter/config.go index a1bc89526b18..c11a1836ae3b 100644 --- a/exporter/splunkhecexporter/config.go +++ b/exporter/splunkhecexporter/config.go @@ -86,10 +86,6 @@ type Config struct { // Splunk index, optional name of the Splunk index. Index string `mapstructure:"index"` - // MaxConnections is used to set a limit to the maximum idle HTTP connection the exporter can keep open. Defaults to 100. - // Deprecated: use HTTPClientSettings.MaxIdleConns or HTTPClientSettings.MaxIdleConnsPerHost instead. - MaxConnections uint `mapstructure:"max_connections"` - // Disable GZip compression. Defaults to false. DisableCompression bool `mapstructure:"disable_compression"` diff --git a/exporter/splunkhecexporter/example/otel-collector-config.yml b/exporter/splunkhecexporter/example/otel-collector-config.yml index b9f008c3fc2e..75c63295faa4 100644 --- a/exporter/splunkhecexporter/example/otel-collector-config.yml +++ b/exporter/splunkhecexporter/example/otel-collector-config.yml @@ -21,8 +21,6 @@ exporters: sourcetype: "otel" # Splunk index, optional name of the Splunk index targeted. index: "metrics" - # Maximum HTTP connections to use simultaneously when sending data. Defaults to 100. - max_connections: 20 # Whether to disable gzip compression over HTTP. Defaults to false. disable_compression: false # HTTP timeout when sending data. Defaults to 10s.