Skip to content

Commit a98acd4

Browse files
committed
Update exporters for exporterbatcher API changes
- exporterhelper.QueueConfig -> exporterhelper.QueueBatchConfig - Update exporter/alertmanager tests - Address open-telemetry/opentelemetry-collector#12718
1 parent 5cf8161 commit a98acd4

File tree

74 files changed

+184
-157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+184
-157
lines changed

exporter/alertmanagerexporter/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414

1515
// Config defines configuration for alertmanager exporter.
1616
type Config struct {
17-
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
18-
QueueSettings exporterhelper.QueueConfig `mapstructure:"sending_queue"`
19-
BackoffConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`
17+
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
18+
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
19+
BackoffConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`
2020

2121
confighttp.ClientConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
2222
GeneratorURL string `mapstructure:"generator_url"`

exporter/alertmanagerexporter/config_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ func TestLoadConfig(t *testing.T) {
5757
RandomizationFactor: backoff.DefaultRandomizationFactor,
5858
Multiplier: backoff.DefaultMultiplier,
5959
},
60-
QueueSettings: exporterhelper.QueueConfig{
60+
QueueSettings: exporterhelper.QueueBatchConfig{
6161
Enabled: true,
62+
Sizer: exporterhelper.RequestSizerTypeRequests,
6263
NumConsumers: 2,
6364
QueueSize: 10,
6465
},

exporter/awscloudwatchlogsexporter/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Config struct {
4343
Tags map[string]*string `mapstructure:"tags"`
4444

4545
// Queue settings frm the exporterhelper
46-
QueueSettings exporterhelper.QueueConfig `mapstructure:"sending_queue"`
46+
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
4747

4848
logger *zap.Logger
4949

exporter/awscloudwatchlogsexporter/config_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ func TestLoadConfig(t *testing.T) {
4444
LogStreamName: "testing",
4545
Endpoint: "",
4646
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
47-
QueueSettings: exporterhelper.QueueConfig{
47+
QueueSettings: exporterhelper.QueueBatchConfig{
4848
Enabled: true,
4949
NumConsumers: 1,
5050
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,
51+
Sizer: exporterhelper.RequestSizerTypeRequests,
5152
},
5253
},
5354
},
@@ -65,10 +66,11 @@ func TestLoadConfig(t *testing.T) {
6566
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
6667
LogGroupName: "test-2",
6768
LogStreamName: "testing",
68-
QueueSettings: exporterhelper.QueueConfig{
69+
QueueSettings: exporterhelper.QueueBatchConfig{
6970
Enabled: true,
7071
NumConsumers: 1,
7172
QueueSize: 2,
73+
Sizer: exporterhelper.RequestSizerTypeRequests,
7274
},
7375
},
7476
},
@@ -119,7 +121,7 @@ func TestRetentionValidateCorrect(t *testing.T) {
119121
Endpoint: "",
120122
LogRetention: 365,
121123
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
122-
QueueSettings: exporterhelper.QueueConfig{
124+
QueueSettings: exporterhelper.QueueBatchConfig{
123125
Enabled: true,
124126
NumConsumers: 1,
125127
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,
@@ -137,7 +139,7 @@ func TestRetentionValidateWrong(t *testing.T) {
137139
Endpoint: "",
138140
LogRetention: 366,
139141
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
140-
QueueSettings: exporterhelper.QueueConfig{
142+
QueueSettings: exporterhelper.QueueBatchConfig{
141143
Enabled: true,
142144
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,
143145
},
@@ -220,7 +222,7 @@ func TestValidateTags(t *testing.T) {
220222
Endpoint: "",
221223
Tags: tt.tags,
222224
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
223-
QueueSettings: exporterhelper.QueueConfig{
225+
QueueSettings: exporterhelper.QueueBatchConfig{
224226
Enabled: true,
225227
NumConsumers: 1,
226228
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,

exporter/awscloudwatchlogsexporter/factory_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ func TestDefaultConfig_exporterSettings(t *testing.T) {
1717
want := &Config{
1818
BackOffConfig: configretry.NewDefaultBackOffConfig(),
1919
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
20-
QueueSettings: exporterhelper.QueueConfig{
20+
QueueSettings: exporterhelper.QueueBatchConfig{
2121
Enabled: true,
2222
NumConsumers: 1,
2323
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,
24+
Sizer: exporterhelper.RequestSizerTypeRequests,
2425
},
2526
}
2627
assert.Equal(t, want, createDefaultConfig())

exporter/awskinesisexporter/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type Encoding struct {
2626

2727
// Config contains the main configuration options for the awskinesis exporter
2828
type Config struct {
29-
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"`
30-
QueueSettings exporterhelper.QueueConfig `mapstructure:"sending_queue"`
29+
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"`
30+
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
3131
configretry.BackOffConfig `mapstructure:"retry_on_failure"`
3232

3333
Encoding `mapstructure:"encoding"`

exporter/awss3exporter/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ const (
5353

5454
// Config contains the main configuration options for the s3 exporter
5555
type Config struct {
56-
QueueSettings exporterhelper.QueueConfig `mapstructure:"sending_queue"`
57-
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
58-
S3Uploader S3UploaderConfig `mapstructure:"s3uploader"`
59-
MarshalerName MarshalerType `mapstructure:"marshaler"`
56+
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
57+
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
58+
S3Uploader S3UploaderConfig `mapstructure:"s3uploader"`
59+
MarshalerName MarshalerType `mapstructure:"marshaler"`
6060

6161
// Encoding to apply. If present, overrides the marshaler configuration option.
6262
Encoding *component.ID `mapstructure:"encoding"`

exporter/awss3exporter/config_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ func TestConfig(t *testing.T) {
6565
require.NoError(t, err)
6666
require.NotNil(t, cfg)
6767

68-
queueCfg := exporterhelper.QueueConfig{
68+
queueCfg := exporterhelper.QueueBatchConfig{
6969
Enabled: true,
7070
NumConsumers: 23,
7171
QueueSize: 42,
72+
Sizer: exporterhelper.RequestSizerTypeRequests,
7273
}
7374

7475
timeoutCfg := exporterhelper.TimeoutConfig{

exporter/azuredataexplorerexporter/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616

1717
// Config defines configuration for Azure Data Explorer Exporter
1818
type Config struct {
19-
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
20-
QueueSettings exporterhelper.QueueConfig `mapstructure:"sending_queue"`
19+
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
20+
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
2121
configretry.BackOffConfig `mapstructure:"retry_on_failure"`
2222
ClusterURI string `mapstructure:"cluster_uri"`
2323
ApplicationID string `mapstructure:"application_id"`

exporter/azuredataexplorerexporter/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestLoadConfig(t *testing.T) {
105105
MaxInterval: 60 * time.Second,
106106
MaxElapsedTime: 10 * time.Minute,
107107
},
108-
QueueSettings: exporterhelper.QueueConfig{
108+
QueueSettings: exporterhelper.QueueBatchConfig{
109109
Enabled: true,
110110
NumConsumers: 2,
111111
QueueSize: 10,

0 commit comments

Comments
 (0)