Skip to content

Commit c54b0a5

Browse files
committed
[exporter/splunkhec] Remove deprecated batcher config
Remove DeprecatedBatchConfig and the batcher mapstructure field. Users should migrate to sending_queue::batch. Assisted-by: Claude Opus 4.6
1 parent 8dd7ce2 commit c54b0a5

File tree

4 files changed

+5
-71
lines changed

4 files changed

+5
-71
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
change_type: breaking
2+
component: exporter/splunk_hec
3+
note: Remove deprecated `batcher` config field. Use `sending_queue::batch` instead.
4+
issues: [47737]
5+
change_logs: [user, api]

exporter/splunkhecexporter/config.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"go.opentelemetry.io/collector/config/configopaque"
1515
"go.opentelemetry.io/collector/config/configoptional"
1616
"go.opentelemetry.io/collector/config/configretry"
17-
"go.opentelemetry.io/collector/confmap"
1817
"go.opentelemetry.io/collector/exporter/exporterhelper"
1918

2019
translator "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/splunk"
@@ -56,22 +55,11 @@ type HecTelemetry struct {
5655
ExtraAttributes map[string]string `mapstructure:"extra_attributes"`
5756
}
5857

59-
type DeprecatedBatchConfig struct {
60-
Enabled bool `mapstructure:"enabled"`
61-
FlushTimeout time.Duration `mapstructure:"flush_timeout"`
62-
Sizer exporterhelper.RequestSizerType `mapstructure:"sizer"`
63-
MinSize int64 `mapstructure:"min_size"`
64-
MaxSize int64 `mapstructure:"max_size"`
65-
isSet bool `mapstructure:"-"`
66-
}
67-
6858
// Config defines configuration for Splunk exporter.
6959
type Config struct {
7060
confighttp.ClientConfig `mapstructure:",squash"`
7161
QueueSettings configoptional.Optional[exporterhelper.QueueBatchConfig] `mapstructure:"sending_queue"`
7262
configretry.BackOffConfig `mapstructure:"retry_on_failure"`
73-
// DeprecatedBatcher is the deprecated batcher configuration.
74-
DeprecatedBatcher DeprecatedBatchConfig `mapstructure:"batcher"`
7563

7664
// LogDataEnabled can be used to disable sending logs by the exporter.
7765
LogDataEnabled bool `mapstructure:"log_data_enabled"`
@@ -142,36 +130,6 @@ type Config struct {
142130
Telemetry HecTelemetry `mapstructure:"telemetry"`
143131
}
144132

145-
func (cfg *Config) Unmarshal(conf *confmap.Conf) error {
146-
if err := conf.Unmarshal(cfg); err != nil {
147-
return err
148-
}
149-
if conf.IsSet("batcher") {
150-
cfg.DeprecatedBatcher.isSet = true
151-
if cfg.QueueSettings.HasValue() && cfg.QueueSettings.Get().Batch.HasValue() {
152-
return errors.New(`deprecated "batcher" cannot be set along with "sending_queue::batch"`)
153-
}
154-
if cfg.DeprecatedBatcher.Enabled {
155-
wasEnabled := cfg.QueueSettings.HasValue()
156-
157-
cfg.QueueSettings.GetOrInsertDefault().Batch = configoptional.Some(exporterhelper.BatchConfig{
158-
FlushTimeout: cfg.DeprecatedBatcher.FlushTimeout,
159-
Sizer: cfg.DeprecatedBatcher.Sizer,
160-
MinSize: cfg.DeprecatedBatcher.MinSize,
161-
MaxSize: cfg.DeprecatedBatcher.MaxSize,
162-
})
163-
164-
// If the deprecated batcher is enabled without a queue, enable blocking queue to replicate the
165-
// behavior of the deprecated batcher.
166-
if !wasEnabled {
167-
cfg.QueueSettings.Get().WaitForResult = true
168-
}
169-
}
170-
}
171-
172-
return nil
173-
}
174-
175133
func (cfg *Config) getURL() (out *url.URL, err error) {
176134
out, err = url.Parse(cfg.Endpoint)
177135
if err != nil {

exporter/splunkhecexporter/config.schema.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
$defs:
2-
deprecated_batch_config:
3-
type: object
4-
properties:
5-
enabled:
6-
type: boolean
7-
flush_timeout:
8-
type: string
9-
format: duration
10-
max_size:
11-
type: integer
12-
x-customType: int64
13-
min_size:
14-
type: integer
15-
x-customType: int64
16-
sizer:
17-
$ref: go.opentelemetry.io/collector/exporter/exporterhelper.request_sizer_type
182
hec_heartbeat:
193
description: HecHeartbeat defines the heartbeat information for the exporter
204
type: object
@@ -46,9 +30,6 @@ $defs:
4630
description: Config defines configuration for Splunk exporter.
4731
type: object
4832
properties:
49-
batcher:
50-
description: DeprecatedBatcher is the deprecated batcher configuration.
51-
$ref: deprecated_batch_config
5233
disable_compression:
5334
description: Disable GZip compression. Defaults to false.
5435
type: boolean

exporter/splunkhecexporter/factory.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"go.opentelemetry.io/collector/consumer"
1616
"go.opentelemetry.io/collector/exporter"
1717
"go.opentelemetry.io/collector/exporter/exporterhelper"
18-
"go.uber.org/zap"
1918

2019
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter/internal/metadata"
2120
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk"
@@ -103,7 +102,6 @@ func createTracesExporter(
103102
config component.Config,
104103
) (exporter.Traces, error) {
105104
cfg := config.(*Config)
106-
showDeprecationWarnings(cfg, set.Logger)
107105
c := newTracesClient(set, cfg)
108106

109107
e, err := exporterhelper.NewTraces(
@@ -140,7 +138,6 @@ func createMetricsExporter(
140138
config component.Config,
141139
) (exporter.Metrics, error) {
142140
cfg := config.(*Config)
143-
showDeprecationWarnings(cfg, set.Logger)
144141
c := newMetricsClient(set, cfg)
145142

146143
e, err := exporterhelper.NewMetrics(
@@ -177,7 +174,6 @@ func createLogsExporter(
177174
config component.Config,
178175
) (exporter exporter.Logs, err error) {
179176
cfg := config.(*Config)
180-
showDeprecationWarnings(cfg, set.Logger)
181177
c := newLogsClient(set, cfg)
182178

183179
logsExporter, err := exporterhelper.NewLogs(
@@ -241,9 +237,3 @@ func hecQueueSettings(qs configoptional.Optional[exporterhelper.QueueBatchConfig
241237
qCopy.Batch = configoptional.Some(bCopy)
242238
return configoptional.Some(qCopy)
243239
}
244-
245-
func showDeprecationWarnings(cfg *Config, logger *zap.Logger) {
246-
if cfg.DeprecatedBatcher.isSet {
247-
logger.Warn("The 'batcher' field is deprecated and will be removed in a future release. Use 'sending_queue::batch' instead.")
248-
}
249-
}

0 commit comments

Comments
 (0)