@glasstrace/sdk 0.13.0 → 0.13.2
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/dist/index.cjs +25 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20456,6 +20456,28 @@ async function configureOtel(config2, sessionManager) {
|
|
|
20456
20456
|
const provider = new BasicTracerProvider({
|
|
20457
20457
|
spanProcessors: [processor]
|
|
20458
20458
|
});
|
|
20459
|
+
const asyncHooks = await tryImport("node:async_hooks");
|
|
20460
|
+
if (!asyncHooks) {
|
|
20461
|
+
trace.setGlobalTracerProvider(provider);
|
|
20462
|
+
registerShutdownHooks(provider);
|
|
20463
|
+
return;
|
|
20464
|
+
}
|
|
20465
|
+
const { AsyncLocalStorage } = asyncHooks;
|
|
20466
|
+
const als = new AsyncLocalStorage();
|
|
20467
|
+
const contextManager = {
|
|
20468
|
+
active: () => als.getStore() ?? ROOT_CONTEXT,
|
|
20469
|
+
with: (context2, fn, thisArg, ...args) => als.run(context2, () => fn.apply(thisArg, args)),
|
|
20470
|
+
bind: (context2, target) => {
|
|
20471
|
+
if (typeof target === "function") {
|
|
20472
|
+
const bound = (...args) => als.run(context2, () => target(...args));
|
|
20473
|
+
return bound;
|
|
20474
|
+
}
|
|
20475
|
+
return target;
|
|
20476
|
+
},
|
|
20477
|
+
enable: () => contextManager,
|
|
20478
|
+
disable: () => contextManager
|
|
20479
|
+
};
|
|
20480
|
+
context.setGlobalContextManager(contextManager);
|
|
20459
20481
|
trace.setGlobalTracerProvider(provider);
|
|
20460
20482
|
registerShutdownHooks(provider);
|
|
20461
20483
|
}
|
|
@@ -20720,8 +20742,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
20720
20742
|
if (config2.verbose) {
|
|
20721
20743
|
console.info("[glasstrace] Background init firing.");
|
|
20722
20744
|
}
|
|
20723
|
-
const healthReport = collectHealthReport("0.13.
|
|
20724
|
-
const initResult = await performInit(config2, anonKeyForInit, "0.13.
|
|
20745
|
+
const healthReport = collectHealthReport("0.13.2");
|
|
20746
|
+
const initResult = await performInit(config2, anonKeyForInit, "0.13.2", healthReport);
|
|
20725
20747
|
if (generation !== registrationGeneration) return;
|
|
20726
20748
|
if (initResult?.claimResult) {
|
|
20727
20749
|
setResolvedApiKey(initResult.claimResult.newApiKey);
|
|
@@ -20729,7 +20751,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
20729
20751
|
}
|
|
20730
20752
|
maybeInstallConsoleCapture();
|
|
20731
20753
|
if (didLastInitSucceed()) {
|
|
20732
|
-
startHeartbeat(config2, anonKeyForInit, "0.13.
|
|
20754
|
+
startHeartbeat(config2, anonKeyForInit, "0.13.2", generation, (newApiKey) => {
|
|
20733
20755
|
setResolvedApiKey(newApiKey);
|
|
20734
20756
|
notifyApiKeyResolved();
|
|
20735
20757
|
});
|