Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/exporter-queuebatch-configoptional-14155.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
component: pkg/exporterhelper

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: It's recommended to change the field type in your component configuration to be `configoptional.Optional[exporterhelper.QueueBatchConfig]` to keep the `enabled` subfield. Use configoptional.Some(exporterhelper.NewDefaultQueueConfig()) to enable by default. Use configoptional.Default(exporterhelper.NewDefaultQueueConfig()) to disable by default.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [44320]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user, api]
3 changes: 2 additions & 1 deletion connector/failoverconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"time"

"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/pipeline"
)
Expand All @@ -19,7 +20,7 @@ var (
type Config struct {
// QueueSettings use the exporterhelper sending_queue to move the queue to the connector to avoid data being stuck
// in the queue of an unhealthy exporter
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
QueueSettings configoptional.Optional[exporterhelper.QueueBatchConfig] `mapstructure:"sending_queue"`

// PipelinePriority is the list of pipeline level priorities in a 1 - n configuration, multiple pipelines can
// sit at a single priority level and will be routed in a fanout. If any pipeline at a level fails, the
Expand Down
2 changes: 1 addition & 1 deletion connector/failoverconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/stretchr/testify v1.11.1
go.opentelemetry.io/collector/component v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/component/componenttest v0.140.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/confmap v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/confmap/xconfmap v0.140.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/connector v0.140.1-0.20251120204106-2e9c82787618
Expand Down Expand Up @@ -40,7 +41,6 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/collector/client v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/config/configretry v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/connector/xconnector v0.140.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.140.1-0.20251120204106-2e9c82787618 // indirect
Expand Down
7 changes: 4 additions & 3 deletions exporter/alertmanagerexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter/exporterhelper"
)

// Config defines configuration for alertmanager exporter.
type Config struct {
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
BackoffConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
QueueSettings configoptional.Optional[exporterhelper.QueueBatchConfig] `mapstructure:"sending_queue"`
BackoffConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`

confighttp.ClientConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
GeneratorURL string `mapstructure:"generator_url"`
Expand Down
3 changes: 2 additions & 1 deletion exporter/alertmanagerexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
Expand Down Expand Up @@ -38,7 +39,7 @@ func createDefaultConfig() component.Config {
EventLabels: []string{"attr1", "attr2"},
TimeoutSettings: exporterhelper.NewDefaultTimeoutConfig(),
BackoffConfig: configretry.NewDefaultBackOffConfig(),
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
QueueSettings: configoptional.Some(exporterhelper.NewDefaultQueueConfig()),
ClientConfig: clientConfig,
}
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/alertmanagerexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
go.opentelemetry.io/collector/component/componenttest v0.140.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/confighttp v0.140.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configopaque v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configretry v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configtls v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/confmap v1.46.1-0.20251120204106-2e9c82787618
Expand Down Expand Up @@ -56,7 +57,6 @@ require (
go.opentelemetry.io/collector/config/configauth v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/config/configcompression v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/config/configmiddleware v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.140.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/consumertest v0.140.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.140.1-0.20251120204106-2e9c82787618 // indirect
Expand Down
3 changes: 2 additions & 1 deletion exporter/awscloudwatchlogsexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.uber.org/zap"
Expand Down Expand Up @@ -43,7 +44,7 @@ type Config struct {
Tags map[string]string `mapstructure:"tags"`

// Queue settings frm the exporterhelper
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
QueueSettings configoptional.Optional[exporterhelper.QueueBatchConfig] `mapstructure:"sending_queue"`

logger *zap.Logger

Expand Down
30 changes: 14 additions & 16 deletions exporter/awscloudwatchlogsexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/confmap/xconfmap"
Expand Down Expand Up @@ -44,11 +45,11 @@ func TestLoadConfig(t *testing.T) {
LogStreamName: "testing",
Endpoint: "",
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
QueueSettings: func() exporterhelper.QueueBatchConfig {
QueueSettings: configoptional.Some(func() exporterhelper.QueueBatchConfig {
queue := exporterhelper.NewDefaultQueueConfig()
queue.NumConsumers = 1
return queue
}(),
}()),
},
},
{
Expand All @@ -65,12 +66,12 @@ func TestLoadConfig(t *testing.T) {
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
LogGroupName: "test-2",
LogStreamName: "testing",
QueueSettings: func() exporterhelper.QueueBatchConfig {
QueueSettings: configoptional.Some(func() exporterhelper.QueueBatchConfig {
queue := exporterhelper.NewDefaultQueueConfig()
queue.NumConsumers = 1
queue.QueueSize = 2
return queue
}(),
}()),
},
},
{
Expand Down Expand Up @@ -120,11 +121,10 @@ func TestRetentionValidateCorrect(t *testing.T) {
Endpoint: "",
LogRetention: 365,
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
QueueSettings: exporterhelper.QueueBatchConfig{
Enabled: true,
QueueSettings: configoptional.Some(exporterhelper.QueueBatchConfig{
NumConsumers: 1,
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,
},
QueueSize: 1000,
}),
}
assert.NoError(t, xconfmap.Validate(cfg))
}
Expand All @@ -138,10 +138,9 @@ func TestRetentionValidateWrong(t *testing.T) {
Endpoint: "",
LogRetention: 366,
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
QueueSettings: exporterhelper.QueueBatchConfig{
Enabled: true,
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,
},
QueueSettings: configoptional.Some(exporterhelper.QueueBatchConfig{
QueueSize: 1000,
}),
}
assert.Error(t, xconfmap.Validate(wrongcfg))
}
Expand Down Expand Up @@ -221,11 +220,10 @@ func TestValidateTags(t *testing.T) {
Endpoint: "",
Tags: tt.tags,
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
QueueSettings: exporterhelper.QueueBatchConfig{
Enabled: true,
QueueSettings: configoptional.Some(exporterhelper.QueueBatchConfig{
NumConsumers: 1,
QueueSize: exporterhelper.NewDefaultQueueConfig().QueueSize,
},
QueueSize: 1000,
}),
}
if tt.errorMessage != "" {
assert.ErrorContains(t, xconfmap.Validate(cfg), tt.errorMessage)
Expand Down
3 changes: 2 additions & 1 deletion exporter/awscloudwatchlogsexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"errors"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
Expand All @@ -35,7 +36,7 @@ func createDefaultConfig() component.Config {
return &Config{
BackOffConfig: configretry.NewDefaultBackOffConfig(),
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
QueueSettings: queueSettings,
QueueSettings: configoptional.Some(queueSettings),
}
}

Expand Down
5 changes: 3 additions & 2 deletions exporter/awscloudwatchlogsexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter/exporterhelper"

Expand All @@ -17,11 +18,11 @@ func TestDefaultConfig_exporterSettings(t *testing.T) {
want := &Config{
BackOffConfig: configretry.NewDefaultBackOffConfig(),
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
QueueSettings: func() exporterhelper.QueueBatchConfig {
QueueSettings: configoptional.Some(func() exporterhelper.QueueBatchConfig {
queue := exporterhelper.NewDefaultQueueConfig()
queue.NumConsumers = 1
return queue
}(),
}()),
}
assert.Equal(t, want, createDefaultConfig())
}
2 changes: 1 addition & 1 deletion exporter/awscloudwatchlogsexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/stretchr/testify v1.11.1
go.opentelemetry.io/collector/component v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/component/componenttest v0.140.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configretry v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/confmap v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/confmap/xconfmap v0.140.1-0.20251120204106-2e9c82787618
Expand Down Expand Up @@ -57,7 +58,6 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/collector/client v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.140.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/consumertest v0.140.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.140.1-0.20251120204106-2e9c82787618 // indirect
Expand Down
5 changes: 3 additions & 2 deletions exporter/awskinesisexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter/exporterhelper"
)
Expand All @@ -26,8 +27,8 @@ type Encoding struct {

// Config contains the main configuration options for the awskinesis exporter
type Config struct {
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"`
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"`
QueueSettings configoptional.Optional[exporterhelper.QueueBatchConfig] `mapstructure:"sending_queue"`
configretry.BackOffConfig `mapstructure:"retry_on_failure"`

Encoding `mapstructure:"encoding"`
Expand Down
3 changes: 2 additions & 1 deletion exporter/awskinesisexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"context"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
Expand Down Expand Up @@ -37,7 +38,7 @@ func createDefaultConfig() component.Config {
return &Config{
TimeoutSettings: exporterhelper.NewDefaultTimeoutConfig(),
BackOffConfig: configretry.NewDefaultBackOffConfig(),
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
QueueSettings: configoptional.Some(exporterhelper.NewDefaultQueueConfig()),
Encoding: Encoding{
Name: defaultEncoding,
Compression: defaultCompression,
Expand Down
2 changes: 1 addition & 1 deletion exporter/awskinesisexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
github.com/stretchr/testify v1.11.1
go.opentelemetry.io/collector/component v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/component/componenttest v0.140.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/config/configretry v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/confmap v1.46.1-0.20251120204106-2e9c82787618
go.opentelemetry.io/collector/confmap/xconfmap v0.140.1-0.20251120204106-2e9c82787618
Expand Down Expand Up @@ -62,7 +63,6 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/collector/client v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/config/configoptional v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer v1.46.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/consumertest v0.140.1-0.20251120204106-2e9c82787618 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.140.1-0.20251120204106-2e9c82787618 // indirect
Expand Down
9 changes: 5 additions & 4 deletions exporter/awss3exporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configcompression"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.uber.org/multierr"
)
Expand Down Expand Up @@ -90,10 +91,10 @@ type ResourceAttrsToS3 struct {

// Config contains the main configuration options for the s3 exporter
type Config struct {
QueueSettings exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"`
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
S3Uploader S3UploaderConfig `mapstructure:"s3uploader"`
MarshalerName MarshalerType `mapstructure:"marshaler"`
QueueSettings configoptional.Optional[exporterhelper.QueueBatchConfig] `mapstructure:"sending_queue"`
TimeoutSettings exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
S3Uploader S3UploaderConfig `mapstructure:"s3uploader"`
MarshalerName MarshalerType `mapstructure:"marshaler"`

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