Skip to content

chore(configuration)!: change parseConfigFile() to *not* add default values, nor merge *_list fields#6765

Merged
trentm merged 17 commits into
open-telemetry:mainfrom
trentm:trentm-conf-drop-defaults-on-parse
Jun 25, 2026
Merged

chore(configuration)!: change parseConfigFile() to *not* add default values, nor merge *_list fields#6765
trentm merged 17 commits into
open-telemetry:mainfrom
trentm:trentm-conf-drop-defaults-on-parse

Conversation

@trentm

@trentm trentm commented May 26, 2026

Copy link
Copy Markdown
Contributor

With this change, the parseConfigFile() will no longer add default values (e.g. adding log_level: 'info' if the config file YAML did not specify log_level) and will no longer merge some *_list fields (e.g. merging resource.attributes_list into resource.attributes).

  • Handling of defaults (nullBehavior and defaultBehavior) belongs in the create() step.
    https://opentelemetry.io/docs/specs/otel/configuration/sdk/#create
  • Config parsing (and validation) is much simpler and clearer. The
    returned type ConfigurationModel object has exactly the data that is
    specified in the file. It still matches the generated TypeScript
    types, which the create() handling (currently in the sdk-node
    package) needs to handle.
  • The configuration package now exports utility functions for doing some of the *_list field merging, that is used by the "create" handling in the sdk-node package.

This is a continuation of #6679 which removed some post-processing of a
parsed and validated config file. See longer discussion here:
#6679 (comment)

…values for unspecified fields

- Handling of defaults (nullBehavior and defaultBehavior) belongs in the
  `create()` step.
  https://opentelemetry.io/docs/specs/otel/configuration/sdk/#create
- Config parsing (and validation) is much simpler and clearer. The
  returned `type ConfigurationModel` object has exactly the data that is
  specified in the file. It still matches the generated TypeScript
  types, which the `parse()` handling (currently in the sdk-node
  package) needs to handle.

This is a continuation of open-telemetry#6679 which removed some post-processing of a
parsed and validated config file.  See longer discussion here:
open-telemetry#6679 (comment)
@trentm trentm self-assigned this May 26, 2026

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.

@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.43590% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.57%. Comparing base (a3e1de7) to head (372745d).

Files with missing lines Patch % Lines
...ental/packages/opentelemetry-sdk-node/src/utils.ts 95.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6765      +/-   ##
==========================================
- Coverage   95.57%   95.57%   -0.01%     
==========================================
  Files         387      387              
  Lines       13162    13146      -16     
  Branches     3016     3001      -15     
==========================================
- Hits        12580    12564      -16     
  Misses        582      582              
Files with missing lines Coverage Δ
...al/packages/configuration/src/FileConfigFactory.ts 97.77% <100.00%> (+1.53%) ⬆️
...ental/packages/opentelemetry-sdk-node/src/utils.ts 96.36% <95.55%> (-0.32%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

trentm added 2 commits May 27, 2026 16:02
That helper for merging resource.attributes and .attribute_list
is now exported as `mergeResourceAttributesConfig(...)`.
Responsibility for merging moves to the "create()" step -- in sdk-node.
The helper for merging propagator.composite and .composite_list
is now exported as `mergePropagatorCompositeConfig(...)`.
Responsibility for merging moves to the "create()" step, currently in sdk-node.

@MikeGoldsmith MikeGoldsmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for putting this together @trentm. Is this ready for feedback?

@trentm

trentm commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for putting this together @trentm. Is this ready for feedback?

@MikeGoldsmith Almost. See the "Checklist" in the description for some work that this PR is waiting for. The big chunk of work was #6775 which just merged. Next is #6817. Then I can finish this off.

@trentm
trentm marked this pull request as ready for review June 19, 2026 21:14
@trentm
trentm requested a review from a team as a code owner June 19, 2026 21:14
Comment thread experimental/packages/configuration/src/FileConfigFactory.ts Outdated
Comment thread experimental/packages/configuration/test/FileConfigFactory.test.ts
Comment thread experimental/packages/configuration/test/FileConfigFactory.test.ts
Comment thread experimental/packages/configuration/test/FileConfigFactory.test.ts
Comment thread experimental/packages/configuration/test/FileConfigFactory.test.ts
@trentm
trentm requested review from MikeGoldsmith and maryliag June 23, 2026 22:25

@maryliag maryliag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Once the last nit is addressed and tests are passing, LGTM

@trentm trentm changed the title chore(configuration)!: change parseConfigFile() to *not* add default values for unspecified fields chore(configuration)!: change parseConfigFile() to *not* add default values, nor merge *_list fields Jun 25, 2026
@trentm
trentm added this pull request to the merge queue Jun 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jun 25, 2026
@trentm
trentm enabled auto-merge June 25, 2026 17:25
@trentm
trentm added this pull request to the merge queue Jun 25, 2026
Merged via the queue into open-telemetry:main with commit 6fde259 Jun 25, 2026
29 checks passed
@trentm
trentm deleted the trentm-conf-drop-defaults-on-parse branch June 25, 2026 17:50
@otelbot-js otelbot-js Bot mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants