Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
20 changes: 0 additions & 20 deletions experimental/packages/configuration/src/FileConfigFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export function parseConfigFile(): ConfigurationModel {
// Strip file_format from output — it's a meta-field, not a config value
delete (data as Record<string, unknown>)['file_format'];

applyConfigDefaults(data);
mergeAttributesList(data);
mergeCompositeList(data);
applyBatchProcessorDefaults(data);
Expand Down Expand Up @@ -207,25 +206,6 @@ function applyPeriodicReaderDefaults(data: ConfigurationModel): void {
}
}

/**
* Apply spec-defined defaults that are not encoded in the JSON schema.
* Both FileConfigFactory and EnvironmentConfigFactory apply the same defaults
* so consumers see consistent behaviour regardless of config source.
*/
function applyConfigDefaults(data: ConfigurationModel): void {
if (data.disabled == null) {
data.disabled = false;
}
if (data.log_level == null) {
data.log_level = 'info';
}
if (data.attribute_limits == null) {
data.attribute_limits = { attribute_count_limit: 128 };
} else if (data.attribute_limits.attribute_count_limit == null) {
data.attribute_limits.attribute_count_limit = 128;
}
}

const ENV_VAR_PATTERN = /\$\{[^}]+\}/;

function substituteEnvVars(obj: unknown): unknown {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,6 @@ describe('FileConfigFactory', function () {
const configFactory = createConfigFactory();
const expectedConfig: ConfigurationModel = {
disabled: false,
log_level: 'info',
attribute_limits: {
attribute_count_limit: 128,
},
resource: {
attributes_list: 'service.instance.id=123',
attributes: [
Comment thread
maryliag marked this conversation as resolved.
Expand Down Expand Up @@ -1082,10 +1078,6 @@ describe('FileConfigFactory', function () {
const configFactory = createConfigFactory();
const expectedConfig: ConfigurationModel = {
disabled: false,
log_level: 'info',
attribute_limits: {
attribute_count_limit: 128,
},
resource: {
schema_url: 'https://opentelemetry.io/schemas/1.16.0',
attributes_list:
Expand Down Expand Up @@ -1175,11 +1167,6 @@ describe('FileConfigFactory', function () {

const config = parseConfigFile();
assert.deepStrictEqual(config, {
disabled: false,
log_level: 'info',
attribute_limits: {
attribute_count_limit: 128,
},
resource: {
attributes_list: null,
},
Expand Down
3 changes: 3 additions & 0 deletions experimental/packages/opentelemetry-sdk-node/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ function create(
if (spanProcessors) {
const spanLimits = getSpanLimitsFromConfiguration(config);
// TODO (6506): support sampler configuration from config
// XXX before decl conf can drop `config.attribute_limits?.attribute_count_limit`
// default from `applyConfigDefaults`, we need to use `TracerProvider` from https://github.com/open-telemetry/opentelemetry-js/pull/6640
// otherwise with an empty value BasicTracerProvider will use envvars.
const tracerProvider = new BasicTracerProvider({
resource,
spanProcessors,
Expand Down
9 changes: 7 additions & 2 deletions packages/opentelemetry-sdk-trace-web/tsconfig.esm.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer note: These formatting changes in tsconfig.* files are from the top-level "postinstall" npm script that updates and re-writes tsconfig files after npm install. This was missed in #6758.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
"dom",
"dom.iterable"
],
"types": ["node", "mocha", "webpack-env", "jquery"],
"outDir": "build/esm",
"rootDir": "src",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo",
"types": [
"node",
"mocha",
"webpack-env",
"jquery"
]
},
"include": [
"src/**/*.ts"
Expand Down
9 changes: 7 additions & 2 deletions packages/opentelemetry-sdk-trace-web/tsconfig.esnext.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
"dom",
"dom.iterable"
],
"types": ["node", "mocha", "webpack-env", "jquery"],
"outDir": "build/esnext",
"rootDir": "src",
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo",
"types": [
"node",
"mocha",
"webpack-env",
"jquery"
]
},
"include": [
"src/**/*.ts"
Expand Down
9 changes: 7 additions & 2 deletions packages/opentelemetry-sdk-trace-web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"dom",
"dom.iterable"
],
"types": ["node", "mocha", "webpack-env", "jquery"],
"outDir": "build",
"rootDir": "."
"rootDir": ".",
"types": [
"node",
"mocha",
"webpack-env",
"jquery"
]
},
"files": [],
"include": [
Expand Down
Loading