@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.d.cts
CHANGED
|
@@ -361,7 +361,6 @@ interface GlasstraceExporterOptions {
|
|
|
361
361
|
environment: string | undefined;
|
|
362
362
|
endpointUrl: string;
|
|
363
363
|
createDelegate: ((url: string, headers: Record<string, string>) => SpanExporter) | null;
|
|
364
|
-
/** @deprecated No-op retained for backward compatibility. Will be removed in a future major. */
|
|
365
364
|
verbose?: boolean;
|
|
366
365
|
}
|
|
367
366
|
/**
|
|
@@ -383,6 +382,7 @@ declare class GlasstraceExporter implements SpanExporter {
|
|
|
383
382
|
private readonly environment;
|
|
384
383
|
private readonly endpointUrl;
|
|
385
384
|
private readonly createDelegateFn;
|
|
385
|
+
private readonly verbose;
|
|
386
386
|
private delegate;
|
|
387
387
|
private delegateKey;
|
|
388
388
|
private pendingBatches;
|
package/dist/index.d.ts
CHANGED
|
@@ -361,7 +361,6 @@ interface GlasstraceExporterOptions {
|
|
|
361
361
|
environment: string | undefined;
|
|
362
362
|
endpointUrl: string;
|
|
363
363
|
createDelegate: ((url: string, headers: Record<string, string>) => SpanExporter) | null;
|
|
364
|
-
/** @deprecated No-op retained for backward compatibility. Will be removed in a future major. */
|
|
365
364
|
verbose?: boolean;
|
|
366
365
|
}
|
|
367
366
|
/**
|
|
@@ -383,6 +382,7 @@ declare class GlasstraceExporter implements SpanExporter {
|
|
|
383
382
|
private readonly environment;
|
|
384
383
|
private readonly endpointUrl;
|
|
385
384
|
private readonly createDelegateFn;
|
|
385
|
+
private readonly verbose;
|
|
386
386
|
private delegate;
|
|
387
387
|
private delegateKey;
|
|
388
388
|
private pendingBatches;
|
package/dist/index.js
CHANGED
|
@@ -577,6 +577,7 @@ var GlasstraceExporter = class {
|
|
|
577
577
|
environment;
|
|
578
578
|
endpointUrl;
|
|
579
579
|
createDelegateFn;
|
|
580
|
+
verbose;
|
|
580
581
|
delegate = null;
|
|
581
582
|
delegateKey = null;
|
|
582
583
|
pendingBatches = [];
|
|
@@ -589,6 +590,7 @@ var GlasstraceExporter = class {
|
|
|
589
590
|
this.environment = options.environment;
|
|
590
591
|
this.endpointUrl = options.endpointUrl;
|
|
591
592
|
this.createDelegateFn = options.createDelegate;
|
|
593
|
+
this.verbose = options.verbose ?? false;
|
|
592
594
|
}
|
|
593
595
|
export(spans, resultCallback) {
|
|
594
596
|
const currentKey = this.getApiKey();
|
|
@@ -596,6 +598,15 @@ var GlasstraceExporter = class {
|
|
|
596
598
|
this.bufferSpans(spans, resultCallback);
|
|
597
599
|
return;
|
|
598
600
|
}
|
|
601
|
+
if (this.verbose) {
|
|
602
|
+
for (const span of spans) {
|
|
603
|
+
const ctx = span.spanContext();
|
|
604
|
+
sdkLog(
|
|
605
|
+
"info",
|
|
606
|
+
`[glasstrace:span-diag] name=${span.name} traceId=${ctx.traceId} spanId=${ctx.spanId} parentSpanId=${span.parentSpanId ?? "root"}`
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
599
610
|
const enrichedSpans = spans.map((span) => this.enrichSpan(span));
|
|
600
611
|
const exporter = this.ensureDelegate();
|
|
601
612
|
if (exporter) {
|
|
@@ -827,6 +838,15 @@ var GlasstraceExporter = class {
|
|
|
827
838
|
this.pendingBatches = [];
|
|
828
839
|
this.pendingSpanCount = 0;
|
|
829
840
|
for (const batch of batches) {
|
|
841
|
+
if (this.verbose) {
|
|
842
|
+
for (const span of batch.spans) {
|
|
843
|
+
const ctx = span.spanContext();
|
|
844
|
+
sdkLog(
|
|
845
|
+
"info",
|
|
846
|
+
`[glasstrace:span-diag] name=${span.name} traceId=${ctx.traceId} spanId=${ctx.spanId} parentSpanId=${span.parentSpanId ?? "root"}`
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
830
850
|
const enriched = batch.spans.map((span) => this.enrichSpan(span));
|
|
831
851
|
exporter.export(enriched, (result) => {
|
|
832
852
|
if (result.code !== 0) {
|
|
@@ -3596,7 +3616,8 @@ async function configureOtel(config, sessionManager) {
|
|
|
3596
3616
|
getConfig: () => getActiveConfig(),
|
|
3597
3617
|
environment: config.environment,
|
|
3598
3618
|
endpointUrl: exporterUrl,
|
|
3599
|
-
createDelegate: createOtlpExporter
|
|
3619
|
+
createDelegate: createOtlpExporter,
|
|
3620
|
+
verbose: config.verbose
|
|
3600
3621
|
});
|
|
3601
3622
|
_activeExporter = glasstraceExporter;
|
|
3602
3623
|
const vercelOtel = await tryImport("@vercel/otel");
|
|
@@ -3902,8 +3923,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
|
|
|
3902
3923
|
if (config.verbose) {
|
|
3903
3924
|
console.info("[glasstrace] Background init firing.");
|
|
3904
3925
|
}
|
|
3905
|
-
const healthReport = collectHealthReport("0.13.
|
|
3906
|
-
const initResult = await performInit(config, anonKeyForInit, "0.13.
|
|
3926
|
+
const healthReport = collectHealthReport("0.13.1");
|
|
3927
|
+
const initResult = await performInit(config, anonKeyForInit, "0.13.1", healthReport);
|
|
3907
3928
|
if (generation !== registrationGeneration) return;
|
|
3908
3929
|
if (initResult?.claimResult) {
|
|
3909
3930
|
setResolvedApiKey(initResult.claimResult.newApiKey);
|
|
@@ -3911,7 +3932,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
|
|
|
3911
3932
|
}
|
|
3912
3933
|
maybeInstallConsoleCapture();
|
|
3913
3934
|
if (didLastInitSucceed()) {
|
|
3914
|
-
startHeartbeat(config, anonKeyForInit, "0.13.
|
|
3935
|
+
startHeartbeat(config, anonKeyForInit, "0.13.1", generation, (newApiKey) => {
|
|
3915
3936
|
setResolvedApiKey(newApiKey);
|
|
3916
3937
|
notifyApiKeyResolved();
|
|
3917
3938
|
});
|