@glasstrace/sdk 0.12.2 → 0.12.3
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/{chunk-MSMOH6IH.js → chunk-J576N5MN.js} +2 -1
- package/dist/index.cjs +38 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +40 -7
- package/dist/index.js.map +1 -1
- package/dist/{source-map-uploader-ZFCYOURS.js → source-map-uploader-ZHD654EG.js} +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-MSMOH6IH.js.map → chunk-J576N5MN.js.map} +0 -0
- /package/dist/{source-map-uploader-ZFCYOURS.js.map → source-map-uploader-ZHD654EG.js.map} +0 -0
|
@@ -473,6 +473,7 @@ export {
|
|
|
473
473
|
isAnonymousMode,
|
|
474
474
|
maybeShowMcpNudge,
|
|
475
475
|
installConsoleCapture,
|
|
476
|
+
sdkLog,
|
|
476
477
|
discoverSourceMapFiles,
|
|
477
478
|
collectSourceMaps,
|
|
478
479
|
computeBuildHash,
|
|
@@ -484,4 +485,4 @@ export {
|
|
|
484
485
|
uploadSourceMapsPresigned,
|
|
485
486
|
uploadSourceMapsAuto
|
|
486
487
|
};
|
|
487
|
-
//# sourceMappingURL=chunk-
|
|
488
|
+
//# sourceMappingURL=chunk-J576N5MN.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -17334,6 +17334,7 @@ var GlasstraceSpanProcessor = class {
|
|
|
17334
17334
|
// src/enriching-exporter.ts
|
|
17335
17335
|
init_esm();
|
|
17336
17336
|
init_dist();
|
|
17337
|
+
init_console_capture();
|
|
17337
17338
|
var ATTR = GLASSTRACE_ATTRIBUTE_NAMES;
|
|
17338
17339
|
var API_KEY_PENDING = "pending";
|
|
17339
17340
|
var MAX_PENDING_SPANS = 1024;
|
|
@@ -17366,7 +17367,12 @@ var GlasstraceExporter = class {
|
|
|
17366
17367
|
const enrichedSpans = spans.map((span) => this.enrichSpan(span));
|
|
17367
17368
|
const exporter = this.ensureDelegate();
|
|
17368
17369
|
if (exporter) {
|
|
17369
|
-
exporter.export(enrichedSpans,
|
|
17370
|
+
exporter.export(enrichedSpans, (result) => {
|
|
17371
|
+
if (result.code !== 0) {
|
|
17372
|
+
sdkLog("warn", `[glasstrace] Span export failed: ${result.error?.message ?? "unknown error"}`);
|
|
17373
|
+
}
|
|
17374
|
+
resultCallback(result);
|
|
17375
|
+
});
|
|
17370
17376
|
recordSpansExported(enrichedSpans.length);
|
|
17371
17377
|
} else {
|
|
17372
17378
|
recordSpansDropped(enrichedSpans.length);
|
|
@@ -17399,7 +17405,14 @@ var GlasstraceExporter = class {
|
|
|
17399
17405
|
return this.delegate.shutdown();
|
|
17400
17406
|
}
|
|
17401
17407
|
}
|
|
17408
|
+
/**
|
|
17409
|
+
* Flushes any pending buffered spans (if the API key has resolved) and
|
|
17410
|
+
* delegates to the underlying exporter's forceFlush to drain its queue.
|
|
17411
|
+
*/
|
|
17402
17412
|
forceFlush() {
|
|
17413
|
+
if (this.getApiKey() !== API_KEY_PENDING && this.pendingBatches.length > 0) {
|
|
17414
|
+
this.flushPending();
|
|
17415
|
+
}
|
|
17403
17416
|
if (this.delegate?.forceFlush) {
|
|
17404
17417
|
return this.delegate.forceFlush();
|
|
17405
17418
|
}
|
|
@@ -17568,7 +17581,12 @@ var GlasstraceExporter = class {
|
|
|
17568
17581
|
this.pendingSpanCount = 0;
|
|
17569
17582
|
for (const batch of batches) {
|
|
17570
17583
|
const enriched = batch.spans.map((span) => this.enrichSpan(span));
|
|
17571
|
-
exporter.export(enriched,
|
|
17584
|
+
exporter.export(enriched, (result) => {
|
|
17585
|
+
if (result.code !== 0) {
|
|
17586
|
+
sdkLog("warn", `[glasstrace] Span export failed: ${result.error?.message ?? "unknown error"}`);
|
|
17587
|
+
}
|
|
17588
|
+
batch.resultCallback(result);
|
|
17589
|
+
});
|
|
17572
17590
|
recordSpansExported(enriched.length);
|
|
17573
17591
|
}
|
|
17574
17592
|
}
|
|
@@ -20309,6 +20327,7 @@ var BasicTracerProvider = class {
|
|
|
20309
20327
|
|
|
20310
20328
|
// src/otel-config.ts
|
|
20311
20329
|
init_esm();
|
|
20330
|
+
init_console_capture();
|
|
20312
20331
|
var _resolvedApiKey = API_KEY_PENDING;
|
|
20313
20332
|
var _activeExporter = null;
|
|
20314
20333
|
var _shutdownHandler = null;
|
|
@@ -20392,7 +20411,21 @@ async function configureOtel(config2, sessionManager) {
|
|
|
20392
20411
|
_activeExporter = null;
|
|
20393
20412
|
return;
|
|
20394
20413
|
}
|
|
20395
|
-
|
|
20414
|
+
if (config2.verbose) {
|
|
20415
|
+
diag2.setLogger(
|
|
20416
|
+
{
|
|
20417
|
+
verbose: (msg) => sdkLog("info", `[otel] ${msg}`),
|
|
20418
|
+
debug: (msg) => sdkLog("info", `[otel] ${msg}`),
|
|
20419
|
+
info: (msg) => sdkLog("info", `[otel] ${msg}`),
|
|
20420
|
+
warn: (msg) => sdkLog("warn", `[otel] ${msg}`),
|
|
20421
|
+
error: (msg) => sdkLog("error", `[otel] ${msg}`)
|
|
20422
|
+
},
|
|
20423
|
+
DiagLogLevel.WARN
|
|
20424
|
+
);
|
|
20425
|
+
}
|
|
20426
|
+
const processor = new BatchSpanProcessor(glasstraceExporter, {
|
|
20427
|
+
scheduledDelayMillis: 1e3
|
|
20428
|
+
});
|
|
20396
20429
|
const provider = new BasicTracerProvider({
|
|
20397
20430
|
spanProcessors: [processor]
|
|
20398
20431
|
});
|
|
@@ -20554,8 +20587,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
20554
20587
|
if (config2.verbose) {
|
|
20555
20588
|
console.info("[glasstrace] Background init firing.");
|
|
20556
20589
|
}
|
|
20557
|
-
const healthReport = collectHealthReport("0.12.
|
|
20558
|
-
const initResult = await performInit(config2, anonKeyForInit, "0.12.
|
|
20590
|
+
const healthReport = collectHealthReport("0.12.3");
|
|
20591
|
+
const initResult = await performInit(config2, anonKeyForInit, "0.12.3", healthReport);
|
|
20559
20592
|
if (generation !== registrationGeneration) return;
|
|
20560
20593
|
if (initResult?.claimResult) {
|
|
20561
20594
|
setResolvedApiKey(initResult.claimResult.newApiKey);
|