Skip to content

refactor(sdk-node): move all existing create<SdkThing>FromConfig() to create-from-config.ts#6924

Merged
trentm merged 1 commit into
open-telemetry:mainfrom
trentm:trentm-moar-create-from-refactoring
Jul 17, 2026
Merged

refactor(sdk-node): move all existing create<SdkThing>FromConfig() to create-from-config.ts#6924
trentm merged 1 commit into
open-telemetry:mainfrom
trentm:trentm-moar-create-from-refactoring

Conversation

@trentm

@trentm trentm commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Also add tests for each of them, adding some tests to what was
there before.
The functions were moved from utils.ts to create-from-config.ts
The only change was adding a few 'checkConfigUse()' internal calls.


This continues on work from #6785
In that PR I added these methods to "utils.ts" because at the same time I'd had a PR starting "create-from-config.ts".

This is a refactor, mostly just moving existing functionality, before I continue work on "fail fast" semantics mentioned at #6785
See this comment from that PR: #6785 (comment)

…o create-from-config.js

Also add tests for each of them, adding some tests to what was
there before.
The functions were *moved* from utils.ts to create-from-config.ts
The only change was adding a few 'checkConfigUse()' internal calls.
@trentm
trentm requested a review from a team as a code owner July 16, 2026 23:16
@trentm trentm self-assigned this Jul 16, 2026
@trentm trentm changed the title refactor(sdk-node): move all existing create<SDK Thing>FromConfig() to create-from-config.js refactor(sdk-node): move all existing create<SdkThing>FromConfig() to create-from-config.js Jul 16, 2026
@trentm trentm changed the title refactor(sdk-node): move all existing create<SdkThing>FromConfig() to create-from-config.js refactor(sdk-node): move all existing create<SdkThing>FromConfig() to create-from-config.ts Jul 16, 2026
logRecordLimits,
// TODO: loggerConfigurator
// TODO: meterProvider
// Note: forceFlushTimeoutMillis not configurable via decl conf.

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.

I know this was not added by your PR, but if is not via decla conf, how user can config it?
do we have anything else to use in the meantine, or the plan is to add this to declarative config?

not something for this pR, but wanted to check what is the plan

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.

I think this the way LoggerProvider and TracerProvider implement this unfortunately ended up being incompatible with declarative config.

We should allow providing options to forceFlush(), similar to how this is done in MeterProvider. That'll allow users to specify it when they call it. The spec does not have any opinion on how to make the timeout configurable, even leaves it open to the implementation to not allow configuring it.

ForceFlush SHOULD complete or abort within some timeout. ForceFlush MAY be implemented as a blocking API or an asynchronous API which notifies the caller via a callback or an event. OpenTelemetry SDK authors MAY decide if they want to make the flush timeout configurable.

My suggestion: let's do this like in sdk-metrics and deprecate/remove the option in the constructor of TracerProvider and LoggerProvider.

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.

ref #6927

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.

ref #6928

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.

I don't have a current plan, beyond calling out cases like this with a note when I see them.
I don't yet know if there are other cases where OTel JS SDK components have configuration options not defined by the current decl conf schema. Relatedly, configuration of instrumentations from YAML will likely never cover all instr config options: specifically the hooks that accept a JS function. (Unless, of course, we get crazy and allow JS hook code in YAML and eval it. That almost certainly won't happen.)

For this case:

  • a forceFlushTimeoutMillis was, I think, first added to TracerProvider here: feat: add forceFlush-function to the BasicTracerProvider-class #2191
  • I didn't see any discussion on that PR about where and whether to make the timeout configurable. An alternative option would have been for TracerProvider#forceFlush() to accept and optional timeout parameter.
  • The spec says: "OpenTelemetry client authors can decide if they want to make the flush timeout configurable." So, I guess, per the spec we could "decide" to not make it configurable via decl conf.

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.

I guess I was writing my response here when Marc was writing and posting his. Marc wins both in time and actually creating issues and PRs.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 17, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-21 19:19:06 UTC.

  • Status: Merged.

This automated status or its linked feedback items may be incorrect. If something looks wrong, report it with the result you expected.

@trentm
trentm added this pull request to the merge queue Jul 17, 2026
Merged via the queue into open-telemetry:main with commit 4e8c9fd Jul 17, 2026
28 of 30 checks passed
@trentm
trentm deleted the trentm-moar-create-from-refactoring branch July 17, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants