SonarQ test on PR #1

Open
andrej wants to merge 14 commits from dev into main
Showing only changes of commit 587effde63 - Show all commits

19
src/tracing.ts Normal file
View File

@@ -0,0 +1,19 @@
// OTel SDK bootstrap — loaded via --require ./dist/tracing.js before the app.
// Auto-configures from OTEL_* env vars set in score.yaml / Humanitec.
// No-ops gracefully when OTEL_EXPORTER_OTLP_ENDPOINT is absent (local dev).
import { NodeSDK } from '@opentelemetry/sdk-node';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
if (endpoint) {
const sdk = new NodeSDK({
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-fs': { enabled: false },
}),
],
});
sdk.start();
process.on('SIGTERM', () => sdk.shutdown().finally(() => process.exit(0)));
}