@glasstrace/sdk 0.12.5 → 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.js CHANGED
@@ -598,17 +598,21 @@ var GlasstraceExporter = class {
598
598
  this.bufferSpans(spans, resultCallback);
599
599
  return;
600
600
  }
601
- const enrichedSpans = spans.map((span) => this.enrichSpan(span));
602
601
  if (this.verbose) {
603
- sdkLog("info", `[glasstrace:diag] Export batch: ${enrichedSpans.length} spans`);
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
+ }
604
609
  }
610
+ const enrichedSpans = spans.map((span) => this.enrichSpan(span));
605
611
  const exporter = this.ensureDelegate();
606
612
  if (exporter) {
607
613
  exporter.export(enrichedSpans, (result) => {
608
614
  if (result.code !== 0) {
609
615
  sdkLog("warn", `[glasstrace] Span export failed: ${result.error?.message ?? "unknown error"}`);
610
- } else if (this.verbose) {
611
- sdkLog("info", `[glasstrace:diag] Export success: ${enrichedSpans.length} spans delivered`);
612
616
  }
613
617
  resultCallback(result);
614
618
  });
@@ -795,17 +799,11 @@ var GlasstraceExporter = class {
795
799
  bufferSpans(spans, resultCallback) {
796
800
  this.pendingBatches.push({ spans, resultCallback });
797
801
  this.pendingSpanCount += spans.length;
798
- if (this.verbose) {
799
- sdkLog("info", `[glasstrace:diag] Buffering ${spans.length} spans (key pending, total: ${this.pendingSpanCount})`);
800
- }
801
802
  while (this.pendingSpanCount > MAX_PENDING_SPANS && this.pendingBatches.length > 1) {
802
803
  const evicted = this.pendingBatches.shift();
803
804
  this.pendingSpanCount -= evicted.spans.length;
804
805
  recordSpansDropped(evicted.spans.length);
805
806
  evicted.resultCallback({ code: 0 });
806
- if (this.verbose) {
807
- sdkLog("info", `[glasstrace:diag] Buffer overflow: evicted ${evicted.spans.length} spans (total pending: ${this.pendingSpanCount})`);
808
- }
809
807
  if (!this.overflowLogged) {
810
808
  this.overflowLogged = true;
811
809
  console.warn(
@@ -840,12 +838,19 @@ var GlasstraceExporter = class {
840
838
  this.pendingBatches = [];
841
839
  this.pendingSpanCount = 0;
842
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
+ }
843
850
  const enriched = batch.spans.map((span) => this.enrichSpan(span));
844
851
  exporter.export(enriched, (result) => {
845
852
  if (result.code !== 0) {
846
853
  sdkLog("warn", `[glasstrace] Span export failed: ${result.error?.message ?? "unknown error"}`);
847
- } else if (this.verbose) {
848
- sdkLog("info", `[glasstrace:diag] Flush export success: ${enriched.length} spans delivered`);
849
854
  }
850
855
  batch.resultCallback(result);
851
856
  });
@@ -3655,9 +3660,6 @@ async function configureOtel(config, sessionManager) {
3655
3660
  const processor = new BatchSpanProcessor(glasstraceExporter, {
3656
3661
  scheduledDelayMillis: 1e3
3657
3662
  });
3658
- if (config.verbose) {
3659
- sdkLog("info", "[glasstrace:diag] BatchSpanProcessor configured: scheduledDelayMillis=1000");
3660
- }
3661
3663
  const provider = new BasicTracerProvider({
3662
3664
  spanProcessors: [processor]
3663
3665
  });
@@ -3921,8 +3923,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
3921
3923
  if (config.verbose) {
3922
3924
  console.info("[glasstrace] Background init firing.");
3923
3925
  }
3924
- const healthReport = collectHealthReport("0.12.5");
3925
- const initResult = await performInit(config, anonKeyForInit, "0.12.5", healthReport);
3926
+ const healthReport = collectHealthReport("0.13.1");
3927
+ const initResult = await performInit(config, anonKeyForInit, "0.13.1", healthReport);
3926
3928
  if (generation !== registrationGeneration) return;
3927
3929
  if (initResult?.claimResult) {
3928
3930
  setResolvedApiKey(initResult.claimResult.newApiKey);
@@ -3930,7 +3932,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
3930
3932
  }
3931
3933
  maybeInstallConsoleCapture();
3932
3934
  if (didLastInitSucceed()) {
3933
- startHeartbeat(config, anonKeyForInit, "0.12.5", generation, (newApiKey) => {
3935
+ startHeartbeat(config, anonKeyForInit, "0.13.1", generation, (newApiKey) => {
3934
3936
  setResolvedApiKey(newApiKey);
3935
3937
  notifyApiKeyResolved();
3936
3938
  });