@glasstrace/sdk 0.13.0 → 0.13.1
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 -4
- 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 +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17357,6 +17357,7 @@ var GlasstraceExporter = class {
|
|
|
17357
17357
|
environment;
|
|
17358
17358
|
endpointUrl;
|
|
17359
17359
|
createDelegateFn;
|
|
17360
|
+
verbose;
|
|
17360
17361
|
delegate = null;
|
|
17361
17362
|
delegateKey = null;
|
|
17362
17363
|
pendingBatches = [];
|
|
@@ -17369,6 +17370,7 @@ var GlasstraceExporter = class {
|
|
|
17369
17370
|
this.environment = options.environment;
|
|
17370
17371
|
this.endpointUrl = options.endpointUrl;
|
|
17371
17372
|
this.createDelegateFn = options.createDelegate;
|
|
17373
|
+
this.verbose = options.verbose ?? false;
|
|
17372
17374
|
}
|
|
17373
17375
|
export(spans, resultCallback) {
|
|
17374
17376
|
const currentKey = this.getApiKey();
|
|
@@ -17376,6 +17378,15 @@ var GlasstraceExporter = class {
|
|
|
17376
17378
|
this.bufferSpans(spans, resultCallback);
|
|
17377
17379
|
return;
|
|
17378
17380
|
}
|
|
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
|
+
}
|
|
17379
17390
|
const enrichedSpans = spans.map((span) => this.enrichSpan(span));
|
|
17380
17391
|
const exporter = this.ensureDelegate();
|
|
17381
17392
|
if (exporter) {
|
|
@@ -17607,6 +17618,15 @@ var GlasstraceExporter = class {
|
|
|
17607
17618
|
this.pendingBatches = [];
|
|
17608
17619
|
this.pendingSpanCount = 0;
|
|
17609
17620
|
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
|
+
}
|
|
17610
17630
|
const enriched = batch.spans.map((span) => this.enrichSpan(span));
|
|
17611
17631
|
exporter.export(enriched, (result) => {
|
|
17612
17632
|
if (result.code !== 0) {
|
|
@@ -20410,7 +20430,8 @@ async function configureOtel(config2, sessionManager) {
|
|
|
20410
20430
|
getConfig: () => getActiveConfig(),
|
|
20411
20431
|
environment: config2.environment,
|
|
20412
20432
|
endpointUrl: exporterUrl,
|
|
20413
|
-
createDelegate: createOtlpExporter
|
|
20433
|
+
createDelegate: createOtlpExporter,
|
|
20434
|
+
verbose: config2.verbose
|
|
20414
20435
|
});
|
|
20415
20436
|
_activeExporter = glasstraceExporter;
|
|
20416
20437
|
const vercelOtel = await tryImport("@vercel/otel");
|
|
@@ -20720,8 +20741,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
20720
20741
|
if (config2.verbose) {
|
|
20721
20742
|
console.info("[glasstrace] Background init firing.");
|
|
20722
20743
|
}
|
|
20723
|
-
const healthReport = collectHealthReport("0.13.
|
|
20724
|
-
const initResult = await performInit(config2, anonKeyForInit, "0.13.
|
|
20744
|
+
const healthReport = collectHealthReport("0.13.1");
|
|
20745
|
+
const initResult = await performInit(config2, anonKeyForInit, "0.13.1", healthReport);
|
|
20725
20746
|
if (generation !== registrationGeneration) return;
|
|
20726
20747
|
if (initResult?.claimResult) {
|
|
20727
20748
|
setResolvedApiKey(initResult.claimResult.newApiKey);
|
|
@@ -20729,7 +20750,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
20729
20750
|
}
|
|
20730
20751
|
maybeInstallConsoleCapture();
|
|
20731
20752
|
if (didLastInitSucceed()) {
|
|
20732
|
-
startHeartbeat(config2, anonKeyForInit, "0.13.
|
|
20753
|
+
startHeartbeat(config2, anonKeyForInit, "0.13.1", generation, (newApiKey) => {
|
|
20733
20754
|
setResolvedApiKey(newApiKey);
|
|
20734
20755
|
notifyApiKeyResolved();
|
|
20735
20756
|
});
|