Merge pull request #29730 from backstage/freben/once

update documentation to register metrics once
This commit is contained in:
Fredrik Adelöw
2025-04-25 16:03:38 +02:00
committed by GitHub
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -27,6 +27,11 @@ yarn --cwd packages/backend add \
In your `packages/backend/src` folder, create an `instrumentation.js` file.
```typescript title="in packages/backend/src/instrumentation.js"
// Prevent from running more than once (due to worker threads)
if (!require('node:worker_threads').isMainThread) {
return;
}
const { NodeSDK } = require('@opentelemetry/sdk-node');
const {
getNodeAutoInstrumentations,
+5
View File
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// Prevent from running more than once (due to worker threads)
if (!require('node:worker_threads').isMainThread) {
return;
}
const { NodeSDK } = require('@opentelemetry/sdk-node');
const {
getNodeAutoInstrumentations,