diff --git a/packages/otel/README.md b/packages/otel/README.md index 2df061d48ae7..644c9964ecc0 100644 --- a/packages/otel/README.md +++ b/packages/otel/README.md @@ -48,11 +48,6 @@ const sdk = new opentelemetry.NodeSDK({ // initialize the SDK and register with the OpenTelemetry API // this enables the API to record telemetry sdk.start() - .then(() => { - return Bootstrap - .configure(/**/) - .run(); - }); // gracefully shut down the SDK on process exit process.on('SIGTERM', () => { @@ -61,6 +56,11 @@ process.on('SIGTERM', () => { .catch((error) => console.log('Error terminating tracing', error)) .finally(() => process.exit(0)); }); + +Bootstrap + .configure(/**/) + .run(); + ``` You can find more information at [opentelemetry-js](https://github.com/open-telemetry/opentelemetry-js) diff --git a/site/docs/extensions/otel.md b/site/docs/extensions/otel.md index 8c45cd51553e..76b99d5c4681 100644 --- a/site/docs/extensions/otel.md +++ b/site/docs/extensions/otel.md @@ -86,11 +86,6 @@ const sdk = new opentelemetry.NodeSDK({ // 初始化 SDK,成功启动之后,再启动 Midway 框架 sdk.start() - .then(() => { - return Bootstrap - .configure(/**/) - .run(); - }); // 在进程关闭时,同时关闭数据采集 process.on('SIGTERM', () => { @@ -99,6 +94,10 @@ process.on('SIGTERM', () => { .catch((error) => console.log('Error terminating tracing', error)) .finally(() => process.exit(0)); }); + +Bootstrap + .configure(/**/) + .run(); ``` diff --git a/site/i18n/en/docusaurus-plugin-content-docs/current/extensions/otel.md b/site/i18n/en/docusaurus-plugin-content-docs/current/extensions/otel.md index 6e1ffa3945e9..759dee95c13f 100644 --- a/site/i18n/en/docusaurus-plugin-content-docs/current/extensions/otel.md +++ b/site/i18n/en/docusaurus-plugin-content-docs/current/extensions/otel.md @@ -86,11 +86,6 @@ const sdk = new opentelemetry.NodeSDK({ // Initialize the SDK and start the Midway framework after successful startup. sdk.start() - .then(() => { - return Bootstrap - .configure(/**/) - .run(); - }); // When the process is closed, data collection is closed at the same time process.on('SIGTERM', () => { @@ -99,6 +94,10 @@ process.on('SIGTERM', () => { .catch((error) => console.log('Error terminating tracing', error)) .finally(() => process.exit(0)); }); + +Bootstrap + .configure(/**/) + .run(); ```