Skip to content

Commit e80049e

Browse files
authored
Remove deprecated batcher config for splunkhecexporter, use sending_queue (open-telemetry#39961)
Signed-off-by: Bogdan Drutu <[email protected]>
1 parent 32132b5 commit e80049e

File tree

6 files changed

+48
-30
lines changed

6 files changed

+48
-30
lines changed

.chloggen/rm-batcher-splunk.yaml

Lines changed: 27 additions & 0 deletions
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: breaking
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: Remove deprecated batcher config for splunkhecexporter, use sending_queue::batch
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: [39961]
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: [user]

exporter/splunkhecexporter/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ type Config struct {
6868
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
6969
configretry.BackOffConfig `mapstructure:"retry_on_failure"`
7070

71-
// Experimental: This configuration is at the early stage of development and may change without backward compatibility
72-
// until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.
73-
BatcherConfig exporterhelper.BatcherConfig `mapstructure:"batcher"` //nolint:staticcheck
74-
7571
// LogDataEnabled can be used to disable sending logs by the exporter.
7672
LogDataEnabled bool `mapstructure:"log_data_enabled"`
7773

exporter/splunkhecexporter/config_test.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,12 @@ func TestLoadConfig(t *testing.T) {
9090
QueueSettings: exporterhelper.QueueBatchConfig{
9191
Enabled: true,
9292
NumConsumers: 2,
93-
QueueSize: 10,
94-
Sizer: exporterhelper.RequestSizerTypeRequests,
95-
},
96-
BatcherConfig: exporterhelper.BatcherConfig{ //nolint:staticcheck
97-
Enabled: true,
98-
FlushTimeout: time.Second,
99-
SizeConfig: exporterhelper.SizeConfig{ //nolint:staticcheck
100-
Sizer: exporterhelper.RequestSizerTypeItems,
101-
MinSize: 1,
102-
MaxSize: 10,
93+
QueueSize: 1000,
94+
Sizer: exporterhelper.RequestSizerTypeItems,
95+
Batch: &exporterhelper.BatchConfig{
96+
FlushTimeout: time.Second,
97+
MinSize: 10,
98+
MaxSize: 100,
10399
},
104100
},
105101
OtelAttrsToHec: splunk.HecToOtelAttrs{
@@ -144,9 +140,9 @@ func TestLoadConfig(t *testing.T) {
144140

145141
sub, err := cm.Sub(tt.id.String())
146142
require.NoError(t, err)
147-
require.NoError(t, sub.Unmarshal(cfg))
148143

149-
assert.NoError(t, xconfmap.Validate(cfg))
144+
require.NoError(t, sub.Unmarshal(cfg))
145+
require.NoError(t, xconfmap.Validate(cfg))
150146
assert.Equal(t, tt.expected, cfg)
151147
})
152148
}

exporter/splunkhecexporter/factory.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ func NewFactory() exporter.Factory {
5858
}
5959

6060
func createDefaultConfig() component.Config {
61-
batcherCfg := exporterhelper.NewDefaultBatcherConfig() //nolint:staticcheck
62-
batcherCfg.Enabled = false
63-
6461
defaultMaxConns := defaultMaxIdleCons
6562
defaultIdleConnTimeout := defaultIdleConnTimeout
6663

@@ -79,7 +76,6 @@ func createDefaultConfig() component.Config {
7976
SplunkAppName: defaultSplunkAppName,
8077
BackOffConfig: configretry.NewDefaultBackOffConfig(),
8178
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
82-
BatcherConfig: batcherCfg,
8379
DisableCompression: false,
8480
MaxContentLengthLogs: defaultContentLengthLogsLimit,
8581
MaxContentLengthMetrics: defaultContentLengthMetricsLimit,
@@ -132,7 +128,6 @@ func createTracesExporter(
132128
exporterhelper.WithQueue(cfg.QueueSettings),
133129
exporterhelper.WithStart(c.start),
134130
exporterhelper.WithShutdown(c.stop),
135-
exporterhelper.WithBatcher(cfg.BatcherConfig), //nolint:staticcheck
136131
)
137132
if err != nil {
138133
return nil, err
@@ -166,7 +161,6 @@ func createMetricsExporter(
166161
exporterhelper.WithQueue(cfg.QueueSettings),
167162
exporterhelper.WithStart(c.start),
168163
exporterhelper.WithShutdown(c.stop),
169-
exporterhelper.WithBatcher(cfg.BatcherConfig), //nolint:staticcheck
170164
)
171165
if err != nil {
172166
return nil, err
@@ -200,7 +194,6 @@ func createLogsExporter(
200194
exporterhelper.WithQueue(cfg.QueueSettings),
201195
exporterhelper.WithStart(c.start),
202196
exporterhelper.WithShutdown(c.stop),
203-
exporterhelper.WithBatcher(cfg.BatcherConfig), //nolint:staticcheck
204197
)
205198
if err != nil {
206199
return nil, err

exporter/splunkhecexporter/factory_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package splunkhecexporter
66
import (
77
"context"
88
"testing"
9+
"time"
910

1011
"github.com/stretchr/testify/assert"
1112
"github.com/stretchr/testify/require"
@@ -111,7 +112,12 @@ func TestFactory_EnabledBatchingMakesExporterMutable(t *testing.T) {
111112
require.NoError(t, err)
112113
assert.False(t, le.Capabilities().MutatesData)
113114

114-
config.BatcherConfig = exporterhelper.NewDefaultBatcherConfig() //nolint:staticcheck
115+
config.QueueSettings = exporterhelper.NewDefaultQueueConfig()
116+
config.QueueSettings.Sizer = exporterhelper.RequestSizerTypeItems
117+
config.QueueSettings.Batch = &exporterhelper.BatchConfig{
118+
FlushTimeout: 200 * time.Millisecond,
119+
MinSize: 8192,
120+
}
115121

116122
me, err = createMetricsExporter(context.Background(), exportertest.NewNopSettings(metadata.Type), config)
117123
require.NoError(t, err)

exporter/splunkhecexporter/testdata/config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ splunk_hec/allsettings:
2020
sending_queue:
2121
enabled: true
2222
num_consumers: 2
23-
queue_size: 10
23+
queue_size: 1000
24+
sizer: "items"
25+
batch:
26+
flush_timeout: 1s
27+
min_size: 10
28+
max_size: 100
2429
retry_on_failure:
2530
enabled: true
2631
initial_interval: 10s
2732
max_interval: 60s
2833
max_elapsed_time: 10m
29-
batcher:
30-
enabled: true
31-
flush_timeout: 1s
32-
min_size: 1
33-
max_size: 10
3434
splunk_app_name: "OpenTelemetry-Collector Splunk Exporter"
3535
splunk_app_version: "v0.0.1"
3636
otel_attrs_to_hec_metadata:

0 commit comments

Comments
 (0)