Skip to content

feat(opentelemetry-sdk-node): set resources and log provider for experimental start#6152

Closed
maryliag wants to merge 18 commits intoopen-telemetry:mainfrom
maryliag:log-provider
Closed

feat(opentelemetry-sdk-node): set resources and log provider for experimental start#6152
maryliag wants to merge 18 commits intoopen-telemetry:mainfrom
maryliag:log-provider

Conversation

@maryliag
Copy link
Copy Markdown
Contributor

@maryliag maryliag commented Nov 22, 2025

Fixes #5822

@maryliag maryliag requested a review from a team as a code owner November 22, 2025 00:15
Comment thread experimental/packages/opentelemetry-sdk-node/src/start.ts Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 22, 2025

Codecov Report

❌ Patch coverage is 94.64286% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.40%. Comparing base (6cca46e) to head (435b72c).
⚠️ Report is 124 commits behind head on main.

Files with missing lines Patch % Lines
...ental/packages/opentelemetry-sdk-node/src/utils.ts 92.06% 5 Missing ⚠️
...ental/packages/opentelemetry-sdk-node/src/start.ts 97.95% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6152      +/-   ##
==========================================
- Coverage   95.40%   95.40%   -0.01%     
==========================================
  Files         317      318       +1     
  Lines        9440     9546     +106     
  Branches     2188     2218      +30     
==========================================
+ Hits         9006     9107     +101     
- Misses        434      439       +5     
Files with missing lines Coverage Δ
...tal/packages/opentelemetry-sdk-node/src/semconv.ts 100.00% <ø> (ø)
...ental/packages/opentelemetry-sdk-node/src/start.ts 98.52% <97.95%> (+2.52%) ⬆️
...ental/packages/opentelemetry-sdk-node/src/utils.ts 93.24% <92.06%> (-0.63%) ⬇️
🚀 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.

Copy link
Copy Markdown
Member

@JamieDanielson JamieDanielson left a comment

Choose a reason for hiding this comment

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

Took a pass through this and added some notes.

config: ConfigurationModel,
sdkOptions: SDKOptions,
resource: Resource | undefined
): LoggerProvider | undefined {
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.

Suggested change
): LoggerProvider | undefined {
): LoggerProvider {

Is there a scenario where setupLoggerProvider would be undefined? setupResource only returns a Resource not undefined

Copy link
Copy Markdown
Contributor Author

@maryliag maryliag Nov 25, 2025

Choose a reason for hiding this comment

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

if you don't have any log provider on env variables or config file, there is no logger provider to be setup, so it will return undefined

setupResource have a default value for resources, this is why it doesn't have the option to return undefined

Comment thread experimental/packages/opentelemetry-sdk-node/src/start.ts Outdated
Comment thread experimental/packages/opentelemetry-sdk-node/src/start.ts Outdated
Comment thread experimental/packages/opentelemetry-sdk-node/src/start.ts Outdated
} else if (exporter.console) {
return new ConsoleLogRecordExporter();
}
diag.warn(`Unsupported Exporter value. Using OTLP http/protobuf.`);
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.

🤔 If someone uses a config file but neglects to specify a valid exporter (otlp_http, otlp_grpc, otlp_file/development(soon), console)... should we default an exporter for them or should we consider it a noop because it's invalid? It's not clear to me.

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 believe I saw the default should be otlp_http in this case, so I kept at that.

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.

Sorry on the delay in coming back to this. In re-reviewing the spec for required and null properties, my understanding is that if a field is required it must be a valid entry to be used and otherwise it is invalid.

When a property is required, the key must be included in the object or the configuration is invalid.

I'll take a look at the go and java implementations to see how they handle it

Comment thread experimental/packages/opentelemetry-sdk-node/src/utils.ts Outdated
@maryliag
Copy link
Copy Markdown
Contributor Author

maryliag commented Nov 25, 2025

I copied the majority of tests form the original sdk tests, to make sure the behaviour didn't change with the new function

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 9, 2026

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions Bot added the stale label Feb 9, 2026
@MikeGoldsmith
Copy link
Copy Markdown
Member

MikeGoldsmith commented Feb 11, 2026

This looks good! All CI passing and the implementation looks right.

Could can you rebase? The PR is 123 commits behind and has a CHANGELOG conflict.

Happy to help review once rebased 😄

@maryliag
Copy link
Copy Markdown
Contributor Author

I'll close this one in favour of a new PR. I made quite a few changes to be compatible with rc3, so this PR needs a lot of updates. I'll open the new updated PR soon :)

@maryliag maryliag closed this Feb 11, 2026
@maryliag
Copy link
Copy Markdown
Contributor Author

New PR: #6407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Create operation returns LoggerProvider

3 participants