Skip to content
Draft
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
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [#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

Expand Down
41 changes: 36 additions & 5 deletions experimental/packages/configuration/src/FileConfigFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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';
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions experimental/packages/configuration/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function getGrpcTlsConfig(
export function initializeDefaultConfiguration(): ConfigurationModel {
return {
disabled: false,
log_level: 'info',
resource: {},
attribute_limits: {
attribute_count_limit: 128,
Expand Down
45 changes: 42 additions & 3 deletions experimental/packages/configuration/test/ConfigFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { parseConfigFile } from '../src/FileConfigFactory';

const defaultConfig: ConfigurationModel = {
disabled: false,
log_level: 'info',
resource: {},
attribute_limits: {
attribute_count_limit: 128,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -2626,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: [
{
Expand All @@ -2636,6 +2671,10 @@ describe('ConfigFactory', function () {
},
},
],
limits: {
attribute_value_length_limit: 4096,
attribute_count_limit: 128,
},
'logger_configurator/development': {
loggers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down
Loading