Fix sdk.start() as Not Async (#5617)

This commit is contained in:
Jackson Weber 2025-04-23 01:11:03 -07:00 committed by GitHub
parent 8efceed28c
commit 9f5ae79b1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 29 deletions

View File

@ -24,6 +24,8 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
### :books: Documentation
* refactor(metrics): Updated metrics samples to no longer treat `sdk.start()` as async [#5617](https://github.com/open-telemetry/opentelemetry-js/pull/5617) @JacksonWeber
### :house: Internal
* test(sdk-metrics): fix multiple problematic assertRejects() calls [#5611](https://github.com/open-telemetry/opentelemetry-js/pull/5611) @cjihrig

View File

@ -71,7 +71,7 @@ const sdk = new opentelemetry.NodeSDK({
// You can optionally detect resources asynchronously from the environment.
// Detected resources are merged with the resources provided in the SDK configuration.
sdk.start().then(() => {
sdk.start();
// Resources have been detected and SDK is started
console.log(`SDK started`)
@ -92,7 +92,6 @@ sdk.start().then(() => {
console.log(`Server is now listening on ${address}`)
})
});
// You can also use the shutdown method to gracefully shut down the SDK before process shutdown
// or on some operating system signal.
@ -159,7 +158,7 @@ const sdk = new opentelemetry.NodeSDK({
// You can optionally detect resources asynchronously from the environment.
// Detected resources are merged with the resources provided in the SDK configuration.
sdk.start().then(() => {
sdk.start();
// Resources have been detected and SDK is started
console.log(`SDK started`)
@ -187,7 +186,6 @@ sdk.start().then(() => {
console.log(`Server is now listening on ${address}`)
})
});
// You can also use the shutdown method to gracefully shut down the SDK before process shutdown
// or on some operating system signal.