@glasstrace/sdk 0.13.1 → 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 +26 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17357,7 +17357,6 @@ var GlasstraceExporter = class {
|
|
|
17357
17357
|
environment;
|
|
17358
17358
|
endpointUrl;
|
|
17359
17359
|
createDelegateFn;
|
|
17360
|
-
verbose;
|
|
17361
17360
|
delegate = null;
|
|
17362
17361
|
delegateKey = null;
|
|
17363
17362
|
pendingBatches = [];
|
|
@@ -17370,7 +17369,6 @@ var GlasstraceExporter = class {
|
|
|
17370
17369
|
this.environment = options.environment;
|
|
17371
17370
|
this.endpointUrl = options.endpointUrl;
|
|
17372
17371
|
this.createDelegateFn = options.createDelegate;
|
|
17373
|
-
this.verbose = options.verbose ?? false;
|
|
17374
17372
|
}
|
|
17375
17373
|
export(spans, resultCallback) {
|
|
17376
17374
|
const currentKey = this.getApiKey();
|
|
@@ -17378,15 +17376,6 @@ var GlasstraceExporter = class {
|
|
|
17378
17376
|
this.bufferSpans(spans, resultCallback);
|
|
17379
17377
|
return;
|
|
17380
17378
|
}
|
|
17381
|
-
if (this.verbose) {
|
|
17382
|
-
for (const span of spans) {
|
|
17383
|
-
const ctx = span.spanContext();
|
|
17384
|
-
sdkLog(
|
|
17385
|
-
"info",
|
|
17386
|
-
`[glasstrace:span-diag] name=${span.name} traceId=${ctx.traceId} spanId=${ctx.spanId} parentSpanId=${span.parentSpanId ?? "root"}`
|
|
17387
|
-
);
|
|
17388
|
-
}
|
|
17389
|
-
}
|
|
17390
17379
|
const enrichedSpans = spans.map((span) => this.enrichSpan(span));
|
|
17391
17380
|
const exporter = this.ensureDelegate();
|
|
17392
17381
|
if (exporter) {
|
|
@@ -17618,15 +17607,6 @@ var GlasstraceExporter = class {
|
|
|
17618
17607
|
this.pendingBatches = [];
|
|
17619
17608
|
this.pendingSpanCount = 0;
|
|
17620
17609
|
for (const batch of batches) {
|
|
17621
|
-
if (this.verbose) {
|
|
17622
|
-
for (const span of batch.spans) {
|
|
17623
|
-
const ctx = span.spanContext();
|
|
17624
|
-
sdkLog(
|
|
17625
|
-
"info",
|
|
17626
|
-
`[glasstrace:span-diag] name=${span.name} traceId=${ctx.traceId} spanId=${ctx.spanId} parentSpanId=${span.parentSpanId ?? "root"}`
|
|
17627
|
-
);
|
|
17628
|
-
}
|
|
17629
|
-
}
|
|
17630
17610
|
const enriched = batch.spans.map((span) => this.enrichSpan(span));
|
|
17631
17611
|
exporter.export(enriched, (result) => {
|
|
17632
17612
|
if (result.code !== 0) {
|
|
@@ -20430,8 +20410,7 @@ async function configureOtel(config2, sessionManager) {
|
|
|
20430
20410
|
getConfig: () => getActiveConfig(),
|
|
20431
20411
|
environment: config2.environment,
|
|
20432
20412
|
endpointUrl: exporterUrl,
|
|
20433
|
-
createDelegate: createOtlpExporter
|
|
20434
|
-
verbose: config2.verbose
|
|
20413
|
+
createDelegate: createOtlpExporter
|
|
20435
20414
|
});
|
|
20436
20415
|
_activeExporter = glasstraceExporter;
|
|
20437
20416
|
const vercelOtel = await tryImport("@vercel/otel");
|
|
@@ -20477,6 +20456,28 @@ async function configureOtel(config2, sessionManager) {
|
|
|
20477
20456
|
const provider = new BasicTracerProvider({
|
|
20478
20457
|
spanProcessors: [processor]
|
|
20479
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);
|
|
20480
20481
|
trace.setGlobalTracerProvider(provider);
|
|
20481
20482
|
registerShutdownHooks(provider);
|
|
20482
20483
|
}
|
|
@@ -20741,8 +20742,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
20741
20742
|
if (config2.verbose) {
|
|
20742
20743
|
console.info("[glasstrace] Background init firing.");
|
|
20743
20744
|
}
|
|
20744
|
-
const healthReport = collectHealthReport("0.13.
|
|
20745
|
-
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);
|
|
20746
20747
|
if (generation !== registrationGeneration) return;
|
|
20747
20748
|
if (initResult?.claimResult) {
|
|
20748
20749
|
setResolvedApiKey(initResult.claimResult.newApiKey);
|
|
@@ -20750,7 +20751,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
20750
20751
|
}
|
|
20751
20752
|
maybeInstallConsoleCapture();
|
|
20752
20753
|
if (didLastInitSucceed()) {
|
|
20753
|
-
startHeartbeat(config2, anonKeyForInit, "0.13.
|
|
20754
|
+
startHeartbeat(config2, anonKeyForInit, "0.13.2", generation, (newApiKey) => {
|
|
20754
20755
|
setResolvedApiKey(newApiKey);
|
|
20755
20756
|
notifyApiKeyResolved();
|
|
20756
20757
|
});
|