From ba4bbe7812729fed4167b462ef700fe275dacbbb Mon Sep 17 00:00:00 2001 From: alex boten <223565+codeboten@users.noreply.github.com> Date: Mon, 8 Sep 2025 10:06:50 -0700 Subject: [PATCH 1/4] [exporter/debug] add support for batching Adds support for batching in the exporter to the debug exporter, allowing users to migrate away from the batch processor and still keep the same functionality with the debug exporter. Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com> --- exporter/debugexporter/config.go | 3 +++ exporter/debugexporter/config_test.go | 4 ++++ exporter/debugexporter/factory.go | 4 ++++ 3 files changed, 11 insertions(+) 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, } } From 4c65f92aa5d3c9945b863965b97d2936b5e9b0e4 Mon Sep 17 00:00:00 2001 From: alex boten <223565+codeboten@users.noreply.github.com> Date: Mon, 8 Sep 2025 10:18:42 -0700 Subject: [PATCH 2/4] changelog Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com> --- .../codeboten_add-batching-to-debug.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .chloggen/codeboten_add-batching-to-debug.yaml diff --git a/.chloggen/codeboten_add-batching-to-debug.yaml b/.chloggen/codeboten_add-batching-to-debug.yaml new file mode 100644 index 00000000000..5ed74488aa6 --- /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: debug + +# 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: + +# 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: [] From 7375a6355685d7b1b09bf48496acfb497b37e224 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Mon, 8 Sep 2025 10:26:08 -0700 Subject: [PATCH 3/4] Update .chloggen/codeboten_add-batching-to-debug.yaml Co-authored-by: Yang Song --- .chloggen/codeboten_add-batching-to-debug.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/codeboten_add-batching-to-debug.yaml b/.chloggen/codeboten_add-batching-to-debug.yaml index 5ed74488aa6..4a83a115713 100644 --- a/.chloggen/codeboten_add-batching-to-debug.yaml +++ b/.chloggen/codeboten_add-batching-to-debug.yaml @@ -15,7 +15,7 @@ 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: +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]' From e791ba1b5ce4c02c5b954fb9d915760a4eade8e3 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Mon, 8 Sep 2025 10:26:13 -0700 Subject: [PATCH 4/4] Update .chloggen/codeboten_add-batching-to-debug.yaml Co-authored-by: Yang Song --- .chloggen/codeboten_add-batching-to-debug.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/codeboten_add-batching-to-debug.yaml b/.chloggen/codeboten_add-batching-to-debug.yaml index 4a83a115713..b5ef487437e 100644 --- a/.chloggen/codeboten_add-batching-to-debug.yaml +++ b/.chloggen/codeboten_add-batching-to-debug.yaml @@ -4,7 +4,7 @@ change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: debug +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