@glasstrace/sdk 0.12.4 → 0.13.0

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.d.cts CHANGED
@@ -361,6 +361,8 @@ 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
+ verbose?: boolean;
364
366
  }
365
367
  /**
366
368
  * A SpanExporter that enriches spans with glasstrace.* attributes at export
package/dist/index.d.ts CHANGED
@@ -361,6 +361,8 @@ 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
+ verbose?: boolean;
364
366
  }
365
367
  /**
366
368
  * A SpanExporter that enriches spans with glasstrace.* attributes at export
package/dist/index.js CHANGED
@@ -694,6 +694,21 @@ var GlasstraceExporter = class {
694
694
  if (statusCode !== void 0) {
695
695
  extra[ATTR.HTTP_STATUS_CODE] = statusCode;
696
696
  }
697
+ if (method && span.status?.code === SpanStatusCode.ERROR) {
698
+ if (statusCode === void 0 || statusCode === 0 || statusCode === 200) {
699
+ const httpErrorType = attrs["error.type"];
700
+ if (typeof httpErrorType === "string") {
701
+ const parsed = parseInt(httpErrorType, 10);
702
+ if (!isNaN(parsed) && parsed >= 400 && parsed <= 599) {
703
+ extra[ATTR.HTTP_STATUS_CODE] = parsed;
704
+ } else {
705
+ extra[ATTR.HTTP_STATUS_CODE] = 500;
706
+ }
707
+ } else {
708
+ extra[ATTR.HTTP_STATUS_CODE] = 500;
709
+ }
710
+ }
711
+ }
697
712
  if (span.startTime && span.endTime) {
698
713
  const [startSec, startNano] = span.startTime;
699
714
  const [endSec, endNano] = span.endTime;
@@ -3887,8 +3902,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
3887
3902
  if (config.verbose) {
3888
3903
  console.info("[glasstrace] Background init firing.");
3889
3904
  }
3890
- const healthReport = collectHealthReport("0.12.4");
3891
- const initResult = await performInit(config, anonKeyForInit, "0.12.4", healthReport);
3905
+ const healthReport = collectHealthReport("0.13.0");
3906
+ const initResult = await performInit(config, anonKeyForInit, "0.13.0", healthReport);
3892
3907
  if (generation !== registrationGeneration) return;
3893
3908
  if (initResult?.claimResult) {
3894
3909
  setResolvedApiKey(initResult.claimResult.newApiKey);
@@ -3896,7 +3911,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
3896
3911
  }
3897
3912
  maybeInstallConsoleCapture();
3898
3913
  if (didLastInitSucceed()) {
3899
- startHeartbeat(config, anonKeyForInit, "0.12.4", generation, (newApiKey) => {
3914
+ startHeartbeat(config, anonKeyForInit, "0.13.0", generation, (newApiKey) => {
3900
3915
  setResolvedApiKey(newApiKey);
3901
3916
  notifyApiKeyResolved();
3902
3917
  });