@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.cjs CHANGED
@@ -17474,6 +17474,21 @@ var GlasstraceExporter = class {
17474
17474
  if (statusCode !== void 0) {
17475
17475
  extra[ATTR.HTTP_STATUS_CODE] = statusCode;
17476
17476
  }
17477
+ if (method && span.status?.code === SpanStatusCode.ERROR) {
17478
+ if (statusCode === void 0 || statusCode === 0 || statusCode === 200) {
17479
+ const httpErrorType = attrs["error.type"];
17480
+ if (typeof httpErrorType === "string") {
17481
+ const parsed = parseInt(httpErrorType, 10);
17482
+ if (!isNaN(parsed) && parsed >= 400 && parsed <= 599) {
17483
+ extra[ATTR.HTTP_STATUS_CODE] = parsed;
17484
+ } else {
17485
+ extra[ATTR.HTTP_STATUS_CODE] = 500;
17486
+ }
17487
+ } else {
17488
+ extra[ATTR.HTTP_STATUS_CODE] = 500;
17489
+ }
17490
+ }
17491
+ }
17477
17492
  if (span.startTime && span.endTime) {
17478
17493
  const [startSec, startNano] = span.startTime;
17479
17494
  const [endSec, endNano] = span.endTime;
@@ -20705,8 +20720,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
20705
20720
  if (config2.verbose) {
20706
20721
  console.info("[glasstrace] Background init firing.");
20707
20722
  }
20708
- const healthReport = collectHealthReport("0.12.4");
20709
- const initResult = await performInit(config2, anonKeyForInit, "0.12.4", healthReport);
20723
+ const healthReport = collectHealthReport("0.13.0");
20724
+ const initResult = await performInit(config2, anonKeyForInit, "0.13.0", healthReport);
20710
20725
  if (generation !== registrationGeneration) return;
20711
20726
  if (initResult?.claimResult) {
20712
20727
  setResolvedApiKey(initResult.claimResult.newApiKey);
@@ -20714,7 +20729,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
20714
20729
  }
20715
20730
  maybeInstallConsoleCapture();
20716
20731
  if (didLastInitSucceed()) {
20717
- startHeartbeat(config2, anonKeyForInit, "0.12.4", generation, (newApiKey) => {
20732
+ startHeartbeat(config2, anonKeyForInit, "0.13.0", generation, (newApiKey) => {
20718
20733
  setResolvedApiKey(newApiKey);
20719
20734
  notifyApiKeyResolved();
20720
20735
  });