From 3b32182d82679856f8fc6f84d9cc29cbe00663d5 Mon Sep 17 00:00:00 2001 From: Mike Goldsmith Date: Fri, 15 May 2026 13:23:16 +0100 Subject: [PATCH 1/3] add missing config fallback defaults for file/env consistency - Fix BLRP schedule_delay default: was 5000 (same as BSP) but spec says 1000 for batch log record processors - Add log_level: 'info' to initializeDefaultConfiguration so env-based config matches file-based config default - Add tracer provider limits defaults (event_count_limit, link_count_limit, event_attribute_count_limit, link_attribute_count_limit) in FileConfigFactory - Add logger provider attribute_count_limit default in FileConfigFactory - Add meter provider exemplar_filter: 'trace_based' default in FileConfigFactory Closes #5945 Assisted-by: Claude Opus 4.6 --- experimental/CHANGELOG.md | 1 + .../configuration/src/FileConfigFactory.ts | 41 ++++++++++++++++--- .../packages/configuration/src/utils.ts | 1 + .../configuration/test/ConfigFactory.test.ts | 7 ++-- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 4d036146cfa..e29a6338b13 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -12,6 +12,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2 ### :bug: Bug Fixes +* fix(configuration): add missing config fallback defaults for consistency between file and env config [#6713](https://github.com/open-telemetry/opentelemetry-js/pull/6713) @MikeGoldsmith * fix(sdk-node): pass gRPC credentials and headers to span exporter in declarative config [#6705](https://github.com/open-telemetry/opentelemetry-js/pull/6705) @MikeGoldsmith * fix(otlp-transformer): do not attempt to skip groups [#6704](https://github.com/open-telemetry/opentelemetry-js/pull/6704) @pichlermarc diff --git a/experimental/packages/configuration/src/FileConfigFactory.ts b/experimental/packages/configuration/src/FileConfigFactory.ts index 57847148619..134b4529d19 100644 --- a/experimental/packages/configuration/src/FileConfigFactory.ts +++ b/experimental/packages/configuration/src/FileConfigFactory.ts @@ -186,20 +186,26 @@ function mergeCompositeList(data: ConfigurationModel): void { * are not encoded in the JSON schema. */ function applyBatchProcessorDefaults(data: ConfigurationModel): void { - const applyDefaults = ( - batch: BatchSpanProcessor | BatchLogRecordProcessor - ) => { + const applySpanDefaults = (batch: BatchSpanProcessor) => { if (batch.schedule_delay == null) batch.schedule_delay = 5000; if (batch.export_timeout == null) batch.export_timeout = 30000; if (batch.max_queue_size == null) batch.max_queue_size = 2048; if (batch.max_export_batch_size == null) batch.max_export_batch_size = 512; }; + // BLRP has a different schedule_delay default (1000) than BSP (5000) + const applyLogDefaults = (batch: BatchLogRecordProcessor) => { + if (batch.schedule_delay == null) batch.schedule_delay = 1000; + if (batch.export_timeout == null) batch.export_timeout = 30000; + if (batch.max_queue_size == null) batch.max_queue_size = 2048; + if (batch.max_export_batch_size == null) batch.max_export_batch_size = 512; + }; + for (const processor of data.tracer_provider?.processors ?? []) { - if (processor.batch) applyDefaults(processor.batch); + if (processor.batch) applySpanDefaults(processor.batch); } for (const processor of data.logger_provider?.processors ?? []) { - if (processor.batch) applyDefaults(processor.batch); + if (processor.batch) applyLogDefaults(processor.batch); } } @@ -235,6 +241,31 @@ function applyConfigDefaults(data: ConfigurationModel): void { } else if (data.attribute_limits.attribute_count_limit == null) { data.attribute_limits.attribute_count_limit = 128; } + + // Tracer provider limits + const tpLimits = data.tracer_provider?.limits; + if (tpLimits) { + if (tpLimits.attribute_count_limit == null) + tpLimits.attribute_count_limit = 128; + if (tpLimits.event_count_limit == null) tpLimits.event_count_limit = 128; + if (tpLimits.link_count_limit == null) tpLimits.link_count_limit = 128; + if (tpLimits.event_attribute_count_limit == null) + tpLimits.event_attribute_count_limit = 128; + if (tpLimits.link_attribute_count_limit == null) + tpLimits.link_attribute_count_limit = 128; + } + + // Logger provider limits + const lpLimits = data.logger_provider?.limits; + if (lpLimits) { + if (lpLimits.attribute_count_limit == null) + lpLimits.attribute_count_limit = 128; + } + + // Meter provider exemplar filter + if (data.meter_provider && data.meter_provider.exemplar_filter == null) { + data.meter_provider.exemplar_filter = 'trace_based'; + } } /** diff --git a/experimental/packages/configuration/src/utils.ts b/experimental/packages/configuration/src/utils.ts index 6d3adeb3426..324fe0d986c 100644 --- a/experimental/packages/configuration/src/utils.ts +++ b/experimental/packages/configuration/src/utils.ts @@ -58,6 +58,7 @@ export function getGrpcTlsConfig( export function initializeDefaultConfiguration(): ConfigurationModel { return { disabled: false, + log_level: 'info', resource: {}, attribute_limits: { attribute_count_limit: 128, diff --git a/experimental/packages/configuration/test/ConfigFactory.test.ts b/experimental/packages/configuration/test/ConfigFactory.test.ts index cbb0faa7f54..c1e07b2ab89 100644 --- a/experimental/packages/configuration/test/ConfigFactory.test.ts +++ b/experimental/packages/configuration/test/ConfigFactory.test.ts @@ -18,6 +18,7 @@ import { parseConfigFile } from '../src/FileConfigFactory'; const defaultConfig: ConfigurationModel = { disabled: false, + log_level: 'info', resource: {}, attribute_limits: { attribute_count_limit: 128, @@ -552,7 +553,7 @@ const configFromKitchenSinkFile = { }, { batch: { - schedule_delay: 5000, + schedule_delay: 1000, export_timeout: 30000, max_queue_size: 2048, max_export_batch_size: 512, @@ -575,7 +576,7 @@ const configFromKitchenSinkFile = { }, { batch: { - schedule_delay: 5000, + schedule_delay: 1000, export_timeout: 30000, max_queue_size: 2048, max_export_batch_size: 512, @@ -588,7 +589,7 @@ const configFromKitchenSinkFile = { }, { batch: { - schedule_delay: 5000, + schedule_delay: 1000, export_timeout: 30000, max_queue_size: 2048, max_export_batch_size: 512, From 05ea1c0d3b3f6f661ddf92f6204a9ec07708b2c9 Mon Sep 17 00:00:00 2001 From: Mike Goldsmith Date: Fri, 15 May 2026 13:24:03 +0100 Subject: [PATCH 2/3] fix changelog PR number --- experimental/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index e29a6338b13..ba60ca127ac 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -12,7 +12,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2 ### :bug: Bug Fixes -* fix(configuration): add missing config fallback defaults for consistency between file and env config [#6713](https://github.com/open-telemetry/opentelemetry-js/pull/6713) @MikeGoldsmith +* fix(configuration): add missing config fallback defaults for consistency between file and env config [#6717](https://github.com/open-telemetry/opentelemetry-js/pull/6717) @MikeGoldsmith * fix(sdk-node): pass gRPC credentials and headers to span exporter in declarative config [#6705](https://github.com/open-telemetry/opentelemetry-js/pull/6705) @MikeGoldsmith * fix(otlp-transformer): do not attempt to skip groups [#6704](https://github.com/open-telemetry/opentelemetry-js/pull/6704) @pichlermarc From 69c2fb2f9786ad99341b65dbba34b2962fdedf1b Mon Sep 17 00:00:00 2001 From: Mike Goldsmith Date: Fri, 15 May 2026 14:01:02 +0100 Subject: [PATCH 3/3] add test coverage for new config defaults Extend test-for-coverage.yaml with tracer_provider (limits), meter_provider (periodic reader), and logger_provider (limits) to exercise the new default-applying code paths. Assisted-by: Claude Opus 4.6 --- .../configuration/test/ConfigFactory.test.ts | 38 +++++++++++++++++++ .../test/fixtures/test-for-coverage.yaml | 14 +++++++ 2 files changed, 52 insertions(+) diff --git a/experimental/packages/configuration/test/ConfigFactory.test.ts b/experimental/packages/configuration/test/ConfigFactory.test.ts index c1e07b2ab89..f33eadcbeb6 100644 --- a/experimental/packages/configuration/test/ConfigFactory.test.ts +++ b/experimental/packages/configuration/test/ConfigFactory.test.ts @@ -2627,6 +2627,40 @@ describe('ConfigFactory', function () { composite: [{ tracecontext: {} }], composite_list: 'tracecontext', }, + tracer_provider: { + processors: [ + { + simple: { + exporter: { + console: {}, + }, + }, + }, + ], + limits: { + attribute_value_length_limit: 4096, + attribute_count_limit: 128, + event_count_limit: 128, + link_count_limit: 128, + event_attribute_count_limit: 128, + link_attribute_count_limit: 128, + }, + }, + meter_provider: { + readers: [ + { + periodic: { + interval: 60000, + timeout: 30000, + exporter: { + console: {}, + }, + cardinality_limits: { default: 2000 }, + }, + }, + ], + exemplar_filter: 'trace_based', + }, logger_provider: { processors: [ { @@ -2637,6 +2671,10 @@ describe('ConfigFactory', function () { }, }, ], + limits: { + attribute_value_length_limit: 4096, + attribute_count_limit: 128, + }, 'logger_configurator/development': { loggers: [ { diff --git a/experimental/packages/configuration/test/fixtures/test-for-coverage.yaml b/experimental/packages/configuration/test/fixtures/test-for-coverage.yaml index a3f8ea2a6b2..5736f06ff57 100644 --- a/experimental/packages/configuration/test/fixtures/test-for-coverage.yaml +++ b/experimental/packages/configuration/test/fixtures/test-for-coverage.yaml @@ -3,11 +3,25 @@ resource: attributes_list: propagator: composite_list: tracecontext +tracer_provider: + processors: + - simple: + exporter: + console: + limits: + attribute_value_length_limit: 4096 +meter_provider: + readers: + - periodic: + exporter: + console: logger_provider: processors: - simple: exporter: console: + limits: + attribute_value_length_limit: 4096 logger_configurator/development: loggers: - name: io.opentelemetry.contrib.*