Skip to content

Commit 26b0610

Browse files
authored
[exporter/splunkhec] enabled http2 healthcheck (#29717)
Same description as in open-telemetry/opentelemetry-collector#9022 This PR enables the HTTP2 health check to workaround the issue described here open-telemetry/opentelemetry-collector#9022 As to why I chose 10 seconds for `HTTP2ReadIdleTimeout` and 10 seconds for `HTTP2PingTimeout` Those values have been tested in production and they will result, in an active env (with default http timeout of 10 seconds and default retry settings), of a single export failure or (2 max) before the health check detects the corrupted tcp connection and closes it. The only drawback is if the connection was not used for over 10 seconds, we might end up sending unnecessary ping frames, which should not be an issue and if it became an issue, then we can tune those settings. The SFX exporter has multiples http clients: - Metric client, Trace client and Event client . Those client will have the http2 health check enabled by default as they share the same default config - Correlation client and Dimension client will NOT have the http2 health check enabled. We can revisit this if needed. **Link to tracking Issue:** <Issue number if applicable> **Testing:** <Describe what testing was performed and which tests were added.> - Run OTEL with one of the exporters that uses HTTP/2 client, example `signalfx` exporter - For simplicity use a single pipeline/exporter - In a different shell, run this to watch the tcp state of the established connection ``` while (true); do echo date; sudo netstat -anp | grep -E '<endpoin_ip_address(es)>' | sort -k 5; sleep 2; done ``` - From the netstat, take a note of the source port and the source IP address - replace <> from previous step `sudo iptables -A OUTPUT -s <source_IP> -p tcp --sport <source_Port> -j DROP` - Note how the OTEL exporter export starts timing out Expected Result: - A new connection should be established, similarly to http/1 and exports should succeed Actual Result: - The exports keep failing for ~ 15 minutes or for whatever the OS `tcp_retries2` is configured to - After 15 minutes, a new tcp connection is created and exports start working **Documentation:** <Describe the documentation added.> Readme is updated Signed-off-by: Dani Louca <[email protected]>
1 parent 40ddee9 commit 26b0610

File tree

4 files changed

+48
-11
lines changed

4 files changed

+48
-11
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: splunkhecexporter
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Enable HTTP/2 health check by default
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [29717]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

exporter/splunkhecexporter/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ The following configuration options can also be configured:
2929
- `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.
3030
- `disable_compression` (default: false): Whether to disable gzip compression over HTTP.
3131
- `timeout` (default: 10s): HTTP timeout when sending data.
32+
- `http2_read_idle_timeout` (default = 10s): Send a ping frame for a health check if the connection has been idle for the configured value.
33+
0s means http/2 health check will be disabled.
34+
- `http2_ping_timeout` (default = 10s): Triggered by `http2_read_idle_timeout`; When there's no response to the ping within the configured value,
35+
the connection will be closed. If this value is set to 0, it will default to 15s.
3236
- `insecure_skip_verify` (default: false): Whether to skip checking the certificate of the HEC endpoint when sending data over HTTPS.
3337
- `ca_file` (no default) Path to the CA cert to verify the server being connected to.
3438
- `cert_file` (no default) Path to the TLS cert to use for client connections when TLS client auth is required.

exporter/splunkhecexporter/config_test.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ func TestLoadConfig(t *testing.T) {
7070
},
7171
InsecureSkipVerify: false,
7272
},
73-
MaxIdleConns: &hundred,
74-
MaxIdleConnsPerHost: &hundred,
75-
IdleConnTimeout: &idleConnTimeout,
73+
MaxIdleConns: &hundred,
74+
MaxIdleConnsPerHost: &hundred,
75+
IdleConnTimeout: &idleConnTimeout,
76+
HTTP2ReadIdleTimeout: 10 * time.Second,
77+
HTTP2PingTimeout: 10 * time.Second,
7678
},
7779
RetrySettings: exporterhelper.RetrySettings{
7880
Enabled: true,

exporter/splunkhecexporter/factory.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ import (
2020
)
2121

2222
const (
23-
defaultMaxIdleCons = 100
24-
defaultHTTPTimeout = 10 * time.Second
25-
defaultIdleConnTimeout = 10 * time.Second
26-
defaultSplunkAppName = "OpenTelemetry Collector Contrib"
23+
defaultMaxIdleCons = 100
24+
defaultHTTPTimeout = 10 * time.Second
25+
defaultHTTP2ReadIdleTimeout = time.Second * 10
26+
defaultHTTP2PingTimeout = time.Second * 10
27+
defaultIdleConnTimeout = 10 * time.Second
28+
defaultSplunkAppName = "OpenTelemetry Collector Contrib"
2729
)
2830

2931
// TODO: Find a place for this to be shared.
@@ -55,10 +57,12 @@ func createDefaultConfig() component.Config {
5557
LogDataEnabled: true,
5658
ProfilingDataEnabled: true,
5759
HTTPClientSettings: confighttp.HTTPClientSettings{
58-
Timeout: defaultHTTPTimeout,
59-
IdleConnTimeout: &defaultIdleConnTimeout,
60-
MaxIdleConnsPerHost: &defaultMaxConns,
61-
MaxIdleConns: &defaultMaxConns,
60+
Timeout: defaultHTTPTimeout,
61+
IdleConnTimeout: &defaultIdleConnTimeout,
62+
MaxIdleConnsPerHost: &defaultMaxConns,
63+
MaxIdleConns: &defaultMaxConns,
64+
HTTP2ReadIdleTimeout: defaultHTTP2ReadIdleTimeout,
65+
HTTP2PingTimeout: defaultHTTP2PingTimeout,
6266
},
6367
SplunkAppName: defaultSplunkAppName,
6468
RetrySettings: exporterhelper.NewDefaultRetrySettings(),

0 commit comments

Comments
 (0)