Skip to content

Conversation

@maryliag
Copy link
Contributor

Fixes #5822

Note: Still need to add tests, but can be reviewed otherwise

@maryliag maryliag requested a review from a team as a code owner November 22, 2025 00:15
@codecov
Copy link

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).

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
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
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
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

} else if (exporter.console) {
return new ConsoleLogRecordExporter();
}
diag.warn(`Unsupported Exporter value. Using OTLP http/protobuf.`);
Copy link
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
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.

@maryliag
Copy link
Contributor Author

maryliag commented Nov 25, 2025

Note: tests will get fixed when this gets merged #6166

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Create operation returns LoggerProvider

2 participants