diff --git a/.chloggen/codeboten_add-batching-to-debug.yaml b/.chloggen/codeboten_add-batching-to-debug.yaml new file mode 100644 index 00000000000..b5ef487437e --- /dev/null +++ b/.chloggen/codeboten_add-batching-to-debug.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: debugexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: add support for batching + +# One or more tracking issues or pull requests related to the change +issues: [13791] + +# (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: The default queue size is 1 + +# 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: [] diff --git a/exporter/debugexporter/config.go b/exporter/debugexporter/config.go index 99b23691e1b..fbf962d7c89 100644 --- a/exporter/debugexporter/config.go +++ b/exporter/debugexporter/config.go @@ -8,6 +8,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/exporter/exporterhelper" ) // supportedLevels in this exporter's configuration. @@ -32,6 +33,8 @@ type Config struct { // UseInternalLogger defines whether the exporter sends the output to the collector's internal logger. UseInternalLogger bool `mapstructure:"use_internal_logger"` + QueueConfig exporterhelper.QueueBatchConfig `mapstructure:"sending_queue"` + // prevent unkeyed literal initialization _ struct{} } diff --git a/exporter/debugexporter/config_test.go b/exporter/debugexporter/config_test.go index e35419d517f..d407c991f4f 100644 --- a/exporter/debugexporter/config_test.go +++ b/exporter/debugexporter/config_test.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/exporter/exporterhelper" ) func TestUnmarshalDefaultConfig(t *testing.T) { @@ -23,6 +24,8 @@ func TestUnmarshalDefaultConfig(t *testing.T) { } func TestUnmarshalConfig(t *testing.T) { + queueCfg := exporterhelper.NewDefaultQueueConfig() + queueCfg.QueueSize = 1 tests := []struct { filename string cfg *Config @@ -34,6 +37,7 @@ func TestUnmarshalConfig(t *testing.T) { Verbosity: configtelemetry.LevelDetailed, SamplingInitial: 10, SamplingThereafter: 50, + QueueConfig: queueCfg, }, }, { diff --git a/exporter/debugexporter/factory.go b/exporter/debugexporter/factory.go index 08151c214d9..49d83e47dec 100644 --- a/exporter/debugexporter/factory.go +++ b/exporter/debugexporter/factory.go @@ -42,11 +42,15 @@ func NewFactory() exporter.Factory { } func createDefaultConfig() component.Config { + queueCfg := exporterhelper.NewDefaultQueueConfig() + queueCfg.QueueSize = 1 + return &Config{ Verbosity: configtelemetry.LevelBasic, SamplingInitial: defaultSamplingInitial, SamplingThereafter: defaultSamplingThereafter, UseInternalLogger: true, + QueueConfig: queueCfg, } }