Skip to content

Commit

Permalink
[exporter/signalfx] [exporter/splunkhec] Remove max_connections confi…
Browse files Browse the repository at this point in the history
…g parameter (open-telemetry#27611)

**Description:**
The max_connections config setting were deprecated with
open-telemetry#16837
and
open-telemetry#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:**
open-telemetry#27610
  • Loading branch information
atoulme authored and jmsnll committed Nov 12, 2023
1 parent f6ece6a commit e36845c
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 43 deletions.
28 changes: 28 additions & 0 deletions .chloggen/remove-max-connections-splunkhecexporter.yaml
Original file line number Diff line number Diff line change
@@ -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: []
28 changes: 28 additions & 0 deletions .chloggen/remove-max-connections.yaml
Original file line number Diff line number Diff line change
@@ -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: []
8 changes: 0 additions & 8 deletions exporter/signalfxexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
}

Expand Down
8 changes: 0 additions & 8 deletions exporter/signalfxexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
10 changes: 0 additions & 10 deletions exporter/signalfxexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
1 change: 0 additions & 1 deletion exporter/splunkhecexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 0 additions & 10 deletions exporter/splunkhecexporter/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 0 additions & 4 deletions exporter/splunkhecexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down
2 changes: 0 additions & 2 deletions exporter/splunkhecexporter/example/otel-collector-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e36845c

Please sign in to comment.