Skip to content

Commit 9b00e23

Browse files
committed
add warning if using deprecated batcher field
Signed-off-by: Alex Boten <[email protected]>
1 parent e75ac30 commit 9b00e23

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

exporter/otlpexporter/config.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"go.opentelemetry.io/collector/component"
1515
"go.opentelemetry.io/collector/config/configgrpc"
1616
"go.opentelemetry.io/collector/config/configretry"
17+
"go.opentelemetry.io/collector/confmap"
1718
"go.opentelemetry.io/collector/exporter/exporterhelper"
1819
)
1920

@@ -29,6 +30,20 @@ type Config struct {
2930
//
3031
// Deprecated: [v0.123.0] batch configuration moving to queue configuration.
3132
BatcherConfig exporterhelper.BatcherConfig `mapstructure:"batcher"`
33+
// remove at the same time as BatcherConfig
34+
hasBatcher bool
35+
}
36+
37+
func (c *Config) Unmarshal(conf *confmap.Conf) error {
38+
if err := conf.Unmarshal(c); err != nil {
39+
return err
40+
}
41+
42+
if conf.IsSet("batcher") {
43+
fmt.Println("in here for sure")
44+
c.hasBatcher = true
45+
}
46+
return nil
3247
}
3348

3449
func (c *Config) Validate() error {

exporter/otlpexporter/otlp.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ type baseExporter struct {
5353
func newExporter(cfg component.Config, set exporter.Settings) *baseExporter {
5454
oCfg := cfg.(*Config)
5555

56+
if oCfg.hasBatcher {
57+
set.TelemetrySettings.Logger.Warn("using deprecated field: batcher")
58+
}
59+
5660
userAgent := fmt.Sprintf("%s/%s (%s/%s)",
5761
set.BuildInfo.Description, set.BuildInfo.Version, runtime.GOOS, runtime.GOARCH)
5862

0 commit comments

Comments
 (0)