@contrail/telemetry 2.0.4-alpha.1 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/lib/logger/index.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/logger/index.js
CHANGED
|
@@ -47,14 +47,15 @@ Object.defineProperty(exports, "withLogAttributes", { enumerable: true, get: fun
|
|
|
47
47
|
// the nested node_modules travels with it and re-creates the duplicate. Published
|
|
48
48
|
// tarballs don't ship node_modules, so this is local-only.
|
|
49
49
|
const TELEMETRY_SINGLETON_KEY = Symbol.for('@contrail/telemetry/logger-initialized');
|
|
50
|
-
|
|
50
|
+
const globalRecord = globalThis;
|
|
51
|
+
if (globalRecord[TELEMETRY_SINGLETON_KEY]) {
|
|
51
52
|
process.stderr.write('[WARN] @contrail/telemetry loaded twice — duplicate module instance detected. ' +
|
|
52
53
|
'flushLogs() will only flush one provider and log context may not propagate correctly. ' +
|
|
53
54
|
'Ensure @contrail/telemetry is listed as a peerDependency in any library that re-exports ' +
|
|
54
55
|
'it, and that the host service lists it in its own package.json.\n');
|
|
55
56
|
}
|
|
56
57
|
else {
|
|
57
|
-
|
|
58
|
+
globalRecord[TELEMETRY_SINGLETON_KEY] = true;
|
|
58
59
|
}
|
|
59
60
|
// --- Environment & Resource Setup ---
|
|
60
61
|
const semantic_conventions_4 = require("../semantic-conventions");
|