@glasstrace/sdk 1.7.0 → 1.9.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.
Files changed (75) hide show
  1. package/dist/async-context/index.cjs +15005 -0
  2. package/dist/async-context/index.cjs.map +1 -0
  3. package/dist/async-context/index.d.cts +174 -0
  4. package/dist/async-context/index.d.ts +174 -0
  5. package/dist/async-context/index.js +13 -0
  6. package/dist/{capture-error-CTgSYxek.d.ts → capture-error-BeuEXXJO.d.cts} +40 -2
  7. package/dist/{capture-error-BmQz7xF6.d.cts → capture-error-D02pzB7q.d.ts} +40 -2
  8. package/dist/chunk-CL3OVHPO.js +23 -0
  9. package/dist/chunk-CL3OVHPO.js.map +1 -0
  10. package/dist/{chunk-WL6BXEJ5.js → chunk-DKV53A2C.js} +2 -2
  11. package/dist/{chunk-3PJP5Y3U.js → chunk-GWIEUBFR.js} +3 -3
  12. package/dist/{chunk-H57MQGNU.js → chunk-H6WJ63X2.js} +2 -2
  13. package/dist/{chunk-NN5YCETI.js → chunk-HD6JIFKN.js} +2 -2
  14. package/dist/{chunk-P45NZR4J.js → chunk-JHUNLPSS.js} +35 -1
  15. package/dist/{chunk-P45NZR4J.js.map → chunk-JHUNLPSS.js.map} +1 -1
  16. package/dist/{chunk-UQKI476D.js → chunk-M6EWJCAT.js} +2 -2
  17. package/dist/chunk-QHV7NFON.js +130 -0
  18. package/dist/chunk-QHV7NFON.js.map +1 -0
  19. package/dist/{chunk-M2TLX6NM.js → chunk-QXITSNYM.js} +3 -3
  20. package/dist/chunk-RQ5BIWDT.js +119 -0
  21. package/dist/chunk-RQ5BIWDT.js.map +1 -0
  22. package/dist/{chunk-OWPA7GHV.js → chunk-XEPC4NFL.js} +1398 -1037
  23. package/dist/chunk-XEPC4NFL.js.map +1 -0
  24. package/dist/cli/init.cjs +4 -4
  25. package/dist/cli/init.cjs.map +1 -1
  26. package/dist/cli/init.js +7 -7
  27. package/dist/cli/mcp-add.cjs +1 -1
  28. package/dist/cli/mcp-add.cjs.map +1 -1
  29. package/dist/cli/mcp-add.js +3 -3
  30. package/dist/cli/uninit.js +3 -3
  31. package/dist/cli/upgrade-instructions.cjs +1 -1
  32. package/dist/cli/upgrade-instructions.js +3 -3
  33. package/dist/cli/validate.cjs.map +1 -1
  34. package/dist/cli/validate.js +2 -2
  35. package/dist/{edge-entry-AWO70gje.d.ts → correlation-id-B_K8adD6.d.ts} +1 -1
  36. package/dist/{edge-entry-DaeG7D7S.d.cts → correlation-id-NAapJ5jn.d.cts} +1 -1
  37. package/dist/edge-entry.cjs +295 -26
  38. package/dist/edge-entry.cjs.map +1 -1
  39. package/dist/edge-entry.d.cts +5 -2
  40. package/dist/edge-entry.d.ts +5 -2
  41. package/dist/edge-entry.js +12 -3
  42. package/dist/index.cjs +3613 -3211
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/{index.d-Dq33YwFT.d.cts → index.d-CkTf_boH.d.cts} +1 -1
  45. package/dist/{index.d-Dq33YwFT.d.ts → index.d-CkTf_boH.d.ts} +1 -1
  46. package/dist/index.d.cts +7 -4
  47. package/dist/index.d.ts +7 -4
  48. package/dist/index.js +6 -5
  49. package/dist/index.js.map +1 -1
  50. package/dist/middleware/index.cjs +15014 -0
  51. package/dist/middleware/index.cjs.map +1 -0
  52. package/dist/middleware/index.d.cts +183 -0
  53. package/dist/middleware/index.d.ts +183 -0
  54. package/dist/middleware/index.js +13 -0
  55. package/dist/middleware/index.js.map +1 -0
  56. package/dist/node-entry.cjs +3613 -3211
  57. package/dist/node-entry.cjs.map +1 -1
  58. package/dist/node-entry.d.cts +3 -3
  59. package/dist/node-entry.d.ts +3 -3
  60. package/dist/node-entry.js +8 -7
  61. package/dist/node-subpath.cjs.map +1 -1
  62. package/dist/node-subpath.d.cts +1 -1
  63. package/dist/node-subpath.d.ts +1 -1
  64. package/dist/node-subpath.js +3 -3
  65. package/dist/{source-map-uploader-XFUEVV7I.js → source-map-uploader-MMJ2WCL4.js} +3 -3
  66. package/dist/source-map-uploader-MMJ2WCL4.js.map +1 -0
  67. package/package.json +13 -1
  68. package/dist/chunk-OWPA7GHV.js.map +0 -1
  69. /package/dist/{source-map-uploader-XFUEVV7I.js.map → async-context/index.js.map} +0 -0
  70. /package/dist/{chunk-WL6BXEJ5.js.map → chunk-DKV53A2C.js.map} +0 -0
  71. /package/dist/{chunk-3PJP5Y3U.js.map → chunk-GWIEUBFR.js.map} +0 -0
  72. /package/dist/{chunk-H57MQGNU.js.map → chunk-H6WJ63X2.js.map} +0 -0
  73. /package/dist/{chunk-NN5YCETI.js.map → chunk-HD6JIFKN.js.map} +0 -0
  74. /package/dist/{chunk-UQKI476D.js.map → chunk-M6EWJCAT.js.map} +0 -0
  75. /package/dist/{chunk-M2TLX6NM.js.map → chunk-QXITSNYM.js.map} +0 -0
@@ -2,8 +2,8 @@ import {
2
2
  identityFingerprint,
3
3
  readMcpMarker,
4
4
  resolveEffectiveMcpCredential
5
- } from "../chunk-WL6BXEJ5.js";
6
- import "../chunk-P45NZR4J.js";
5
+ } from "../chunk-DKV53A2C.js";
6
+ import "../chunk-JHUNLPSS.js";
7
7
  import "../chunk-NSBPE2FW.js";
8
8
 
9
9
  // src/cli/validate.ts
@@ -1,4 +1,4 @@
1
- import { i as SdkDiagnosticCode, j as SessionId, C as CaptureConfig } from './index.d-Dq33YwFT.js';
1
+ import { f as SdkDiagnosticCode, g as SessionId, C as CaptureConfig } from './index.d-CkTf_boH.js';
2
2
  import { ReadableSpan } from './export/ReadableSpan';
3
3
  import { Span } from './Span';
4
4
  import { SpanProcessor } from './SpanProcessor';
@@ -1,4 +1,4 @@
1
- import { i as SdkDiagnosticCode, j as SessionId, C as CaptureConfig } from './index.d-Dq33YwFT.cjs';
1
+ import { f as SdkDiagnosticCode, g as SessionId, C as CaptureConfig } from './index.d-CkTf_boH.cjs';
2
2
  import { ReadableSpan } from './export/ReadableSpan';
3
3
  import { Span } from './Span';
4
4
  import { SpanProcessor } from './SpanProcessor';
@@ -22,7 +22,9 @@ var edge_entry_exports = {};
22
22
  __export(edge_entry_exports, {
23
23
  GlasstraceSpanProcessor: () => GlasstraceSpanProcessor,
24
24
  SdkError: () => SdkError,
25
- captureCorrelationId: () => captureCorrelationId
25
+ captureCorrelationId: () => captureCorrelationId,
26
+ tracedRequestMiddleware: () => tracedRequestMiddleware,
27
+ withAsyncCausality: () => withAsyncCausality
26
28
  });
27
29
  module.exports = __toCommonJS(edge_entry_exports);
28
30
 
@@ -305,14 +307,14 @@ var BaseContext = class _BaseContext {
305
307
  self2._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
306
308
  self2.getValue = (key) => self2._currentContext.get(key);
307
309
  self2.setValue = (key, value) => {
308
- const context = new _BaseContext(self2._currentContext);
309
- context._currentContext.set(key, value);
310
- return context;
310
+ const context2 = new _BaseContext(self2._currentContext);
311
+ context2._currentContext.set(key, value);
312
+ return context2;
311
313
  };
312
314
  self2.deleteValue = (key) => {
313
- const context = new _BaseContext(self2._currentContext);
314
- context._currentContext.delete(key);
315
- return context;
315
+ const context2 = new _BaseContext(self2._currentContext);
316
+ context2._currentContext.delete(key);
317
+ return context2;
316
318
  };
317
319
  }
318
320
  };
@@ -373,8 +375,8 @@ var ContextAPI = class _ContextAPI {
373
375
  * @param thisArg optional receiver to be used for calling fn
374
376
  * @param args optional arguments forwarded to fn
375
377
  */
376
- with(context, fn, thisArg, ...args) {
377
- return this._getContextManager().with(context, fn, thisArg, ...args);
378
+ with(context2, fn, thisArg, ...args) {
379
+ return this._getContextManager().with(context2, fn, thisArg, ...args);
378
380
  }
379
381
  /**
380
382
  * Bind a context to a target function or event emitter
@@ -382,8 +384,8 @@ var ContextAPI = class _ContextAPI {
382
384
  * @param context context to bind to the event emitter or function. Defaults to the currently active context
383
385
  * @param target function or event emitter to bind
384
386
  */
385
- bind(context, target) {
386
- return this._getContextManager().bind(context, target);
387
+ bind(context2, target) {
388
+ return this._getContextManager().bind(context2, target);
387
389
  }
388
390
  _getContextManager() {
389
391
  return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
@@ -460,24 +462,24 @@ var NonRecordingSpan = class {
460
462
 
461
463
  // ../../node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
462
464
  var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
463
- function getSpan(context) {
464
- return context.getValue(SPAN_KEY) || void 0;
465
+ function getSpan(context2) {
466
+ return context2.getValue(SPAN_KEY) || void 0;
465
467
  }
466
468
  function getActiveSpan() {
467
469
  return getSpan(ContextAPI.getInstance().active());
468
470
  }
469
- function setSpan(context, span) {
470
- return context.setValue(SPAN_KEY, span);
471
+ function setSpan(context2, span) {
472
+ return context2.setValue(SPAN_KEY, span);
471
473
  }
472
- function deleteSpan(context) {
473
- return context.deleteValue(SPAN_KEY);
474
+ function deleteSpan(context2) {
475
+ return context2.deleteValue(SPAN_KEY);
474
476
  }
475
- function setSpanContext(context, spanContext) {
476
- return setSpan(context, new NonRecordingSpan(spanContext));
477
+ function setSpanContext(context2, spanContext) {
478
+ return setSpan(context2, new NonRecordingSpan(spanContext));
477
479
  }
478
- function getSpanContext(context) {
480
+ function getSpanContext(context2) {
479
481
  var _a2;
480
- return (_a2 = getSpan(context)) === null || _a2 === void 0 ? void 0 : _a2.spanContext();
482
+ return (_a2 = getSpan(context2)) === null || _a2 === void 0 ? void 0 : _a2.spanContext();
481
483
  }
482
484
 
483
485
  // ../../node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
@@ -612,12 +614,12 @@ function wrapSpanContext(spanContext) {
612
614
  var contextApi = ContextAPI.getInstance();
613
615
  var NoopTracer = class {
614
616
  // startSpan starts a noop span.
615
- startSpan(name, options, context = contextApi.active()) {
617
+ startSpan(name, options, context2 = contextApi.active()) {
616
618
  const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
617
619
  if (root) {
618
620
  return new NonRecordingSpan();
619
621
  }
620
- const parentFromContext = context && getSpanContext(context);
622
+ const parentFromContext = context2 && getSpanContext(context2);
621
623
  if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
622
624
  return new NonRecordingSpan(parentFromContext);
623
625
  } else {
@@ -659,8 +661,8 @@ var ProxyTracer = class {
659
661
  this.version = version2;
660
662
  this.options = options;
661
663
  }
662
- startSpan(name, options, context) {
663
- return this._getTracer().startSpan(name, options, context);
664
+ startSpan(name, options, context2) {
665
+ return this._getTracer().startSpan(name, options, context2);
664
666
  }
665
667
  startActiveSpan(_name, _options, _context, _fn) {
666
668
  const tracer = this._getTracer();
@@ -716,6 +718,17 @@ var ProxyTracerProvider = class {
716
718
  }
717
719
  };
718
720
 
721
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/status.js
722
+ var SpanStatusCode;
723
+ (function(SpanStatusCode2) {
724
+ SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
725
+ SpanStatusCode2[SpanStatusCode2["OK"] = 1] = "OK";
726
+ SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
727
+ })(SpanStatusCode || (SpanStatusCode = {}));
728
+
729
+ // ../../node_modules/@opentelemetry/api/build/esm/context-api.js
730
+ var context = ContextAPI.getInstance();
731
+
719
732
  // ../../node_modules/@opentelemetry/api/build/esm/api/trace.js
720
733
  var API_NAME3 = "trace";
721
734
  var TraceAPI = class _TraceAPI {
@@ -14653,6 +14666,40 @@ var GLASSTRACE_ATTRIBUTE_NAMES = {
14653
14666
  ELEMENT_FINGERPRINT: "glasstrace.element.fingerprint",
14654
14667
  ELEMENT_CONFIDENCE: "glasstrace.element.confidence",
14655
14668
  TAB_ID: "glasstrace.tab.id",
14669
+ // Causal evidence (SDK-046 / DISC-1537 + DISC-1539).
14670
+ //
14671
+ // The SDK emits `glasstrace.causal.*` attributes on spans that
14672
+ // carry instrumentation-time evidence about a span's relationship
14673
+ // to its owning request trace. Two families are defined here:
14674
+ //
14675
+ // - `MIDDLEWARE_FOR_REQUEST` — middleware-ownership marker. Set
14676
+ // on a middleware-only span by `tracedRequestMiddleware()` from
14677
+ // `@glasstrace/sdk/middleware`. Carries the originating
14678
+ // request's normalized path so the product-side trace-summary
14679
+ // transform can link the middleware span to the owning HTTP
14680
+ // request trace even when the middleware runs in an edge
14681
+ // runtime that does not propagate AsyncLocalStorage parents.
14682
+ //
14683
+ // - `POST_RESPONSE_ASYNC` — post-response async marker. Set on a
14684
+ // span emitted from inside `withAsyncCausality()` from
14685
+ // `@glasstrace/sdk/async-context`. Carries the originating
14686
+ // request's trace ID (32-character hex) captured at the call
14687
+ // site so async work scheduled via Next.js `after()`, queues,
14688
+ // or webhooks can be linked back to its originating request.
14689
+ // Companion booleans `CAUSAL_AFFECTS_HTTP_STATUS` /
14690
+ // `CAUSAL_AFFECTS_HTTP_DURATION` document whether the async
14691
+ // work participates in the root request's outcome (default
14692
+ // `false` — non-outcome async work).
14693
+ //
14694
+ // Wire keys live under the `glasstrace.causal.*` namespace so they
14695
+ // are namespace-distinct from `glasstrace.error.*`,
14696
+ // `glasstrace.http.*`, `glasstrace.trpc.*`, and the side-effect
14697
+ // family below. Adding these constants is a `@glasstrace/protocol`
14698
+ // minor bump; existing entries are untouched.
14699
+ CAUSAL_MIDDLEWARE_FOR_REQUEST: "glasstrace.causal.middleware_for_request",
14700
+ CAUSAL_POST_RESPONSE_ASYNC: "glasstrace.causal.post_response_async",
14701
+ CAUSAL_AFFECTS_HTTP_STATUS: "glasstrace.causal.affects_http_status",
14702
+ CAUSAL_AFFECTS_HTTP_DURATION: "glasstrace.causal.affects_http_duration",
14656
14703
  // Side-effect evidence (SDK-049 / SCHEMA-036).
14657
14704
  // Top-level operation attributes attached to the active span when a
14658
14705
  // side-effect is recorded via `recordSideEffect()`. The wire-string
@@ -14932,10 +14979,232 @@ function firstToken(value) {
14932
14979
  }
14933
14980
  return void 0;
14934
14981
  }
14982
+
14983
+ // src/optional-lifecycle.ts
14984
+ var EMIT_BRIDGE = /* @__PURE__ */ Symbol.for("glasstrace.lifecycle.emit-bridge");
14985
+ function tryEmitLifecycleEvent(event, payload) {
14986
+ try {
14987
+ const slot = globalThis[EMIT_BRIDGE];
14988
+ if (!slot) return;
14989
+ slot.emit(event, payload);
14990
+ } catch {
14991
+ }
14992
+ }
14993
+
14994
+ // src/middleware/index.ts
14995
+ var ATTR2 = GLASSTRACE_ATTRIBUTE_NAMES;
14996
+ var TRACER_NAME = "@glasstrace/sdk/middleware";
14997
+ var _skippedUninstalledEmitted = false;
14998
+ function extractRequestPath(req) {
14999
+ if (req === null || typeof req !== "object") return void 0;
15000
+ try {
15001
+ const nextUrl = req.nextUrl;
15002
+ if (nextUrl !== null && typeof nextUrl === "object") {
15003
+ const pathname = nextUrl.pathname;
15004
+ if (typeof pathname === "string" && pathname.length > 0) {
15005
+ return pathname;
15006
+ }
15007
+ }
15008
+ const url2 = req.url;
15009
+ if (typeof url2 === "string" && url2.length > 0) {
15010
+ try {
15011
+ return new URL(url2).pathname;
15012
+ } catch {
15013
+ try {
15014
+ return new URL(url2, "http://localhost").pathname;
15015
+ } catch {
15016
+ return void 0;
15017
+ }
15018
+ }
15019
+ }
15020
+ } catch {
15021
+ }
15022
+ return void 0;
15023
+ }
15024
+ var INVALID_TRACE_ID = "00000000000000000000000000000000";
15025
+ function isNoopSpan(span) {
15026
+ try {
15027
+ return span.spanContext().traceId === INVALID_TRACE_ID;
15028
+ } catch {
15029
+ return false;
15030
+ }
15031
+ }
15032
+ function tracedRequestMiddleware(options, handler) {
15033
+ if (typeof options.name !== "string" || options.name.length === 0) {
15034
+ throw new TypeError(
15035
+ "tracedRequestMiddleware: options.name must be a non-empty string"
15036
+ );
15037
+ }
15038
+ const wrapped = ((req, ...rest) => {
15039
+ const tracer = trace.getTracer(TRACER_NAME);
15040
+ return tracer.startActiveSpan(options.name, (span) => {
15041
+ if (isNoopSpan(span)) {
15042
+ if (!_skippedUninstalledEmitted) {
15043
+ _skippedUninstalledEmitted = true;
15044
+ tryEmitLifecycleEvent("middleware:skipped_uninstalled", {});
15045
+ }
15046
+ endSpanSafely(span);
15047
+ return handler(req, ...rest);
15048
+ }
15049
+ try {
15050
+ if (options.attributes) {
15051
+ span.setAttributes(options.attributes);
15052
+ }
15053
+ const path = extractRequestPath(req);
15054
+ if (path !== void 0) {
15055
+ span.setAttribute(ATTR2.CAUSAL_MIDDLEWARE_FOR_REQUEST, path);
15056
+ }
15057
+ } catch {
15058
+ }
15059
+ let result;
15060
+ try {
15061
+ result = handler(req, ...rest);
15062
+ } catch (error48) {
15063
+ recordSpanError(span, error48);
15064
+ endSpanSafely(span);
15065
+ throw error48;
15066
+ }
15067
+ if (result !== null && typeof result === "object" && typeof result.then === "function") {
15068
+ return result.then(
15069
+ (value) => {
15070
+ endSpanSafely(span);
15071
+ return value;
15072
+ },
15073
+ (error48) => {
15074
+ recordSpanError(span, error48);
15075
+ endSpanSafely(span);
15076
+ throw error48;
15077
+ }
15078
+ );
15079
+ }
15080
+ endSpanSafely(span);
15081
+ return result;
15082
+ });
15083
+ });
15084
+ return wrapped;
15085
+ }
15086
+ function recordSpanError(span, error48) {
15087
+ const normalized = error48 instanceof Error ? error48 : typeof error48 === "string" ? error48 : new Error(String(error48));
15088
+ const statusMessage = normalized instanceof Error ? normalized.message : normalized;
15089
+ try {
15090
+ span.recordException(normalized);
15091
+ } catch {
15092
+ }
15093
+ try {
15094
+ span.setStatus({ code: SpanStatusCode.ERROR, message: statusMessage });
15095
+ } catch {
15096
+ }
15097
+ }
15098
+ function endSpanSafely(span) {
15099
+ try {
15100
+ span.end();
15101
+ } catch {
15102
+ }
15103
+ }
15104
+
15105
+ // src/async-context/index.ts
15106
+ var ATTR3 = GLASSTRACE_ATTRIBUTE_NAMES;
15107
+ var TRACER_NAME2 = "@glasstrace/sdk/async-context";
15108
+ var INVALID_TRACE_ID2 = "00000000000000000000000000000000";
15109
+ var _skippedUninstalledEmitted2 = false;
15110
+ var _noOriginatingContextEmitted = false;
15111
+ function withAsyncCausality(options, fn) {
15112
+ if (typeof options.name !== "string" || options.name.length === 0) {
15113
+ throw new TypeError(
15114
+ "withAsyncCausality: options.name must be a non-empty string"
15115
+ );
15116
+ }
15117
+ if (typeof fn !== "function") {
15118
+ throw new TypeError("withAsyncCausality: fn must be a function");
15119
+ }
15120
+ const capturedContext = (() => {
15121
+ try {
15122
+ const active = trace.getActiveSpan();
15123
+ if (!active) return void 0;
15124
+ const ctx = active.spanContext();
15125
+ if (ctx.traceId === INVALID_TRACE_ID2) return void 0;
15126
+ return ctx;
15127
+ } catch {
15128
+ return void 0;
15129
+ }
15130
+ })();
15131
+ return async () => {
15132
+ const tracer = trace.getTracer(TRACER_NAME2);
15133
+ const span = tracer.startSpan(options.name, {
15134
+ root: true,
15135
+ links: capturedContext !== void 0 ? [{ context: capturedContext }] : void 0
15136
+ });
15137
+ if (isNoopSpan2(span)) {
15138
+ if (!_skippedUninstalledEmitted2) {
15139
+ _skippedUninstalledEmitted2 = true;
15140
+ tryEmitLifecycleEvent("async:skipped_uninstalled", {});
15141
+ }
15142
+ endSpanSafely2(span);
15143
+ return Promise.resolve(fn());
15144
+ }
15145
+ if (capturedContext === void 0 && !_noOriginatingContextEmitted) {
15146
+ _noOriginatingContextEmitted = true;
15147
+ tryEmitLifecycleEvent("async:no_originating_context", {});
15148
+ }
15149
+ try {
15150
+ if (options.attributes) {
15151
+ span.setAttributes(options.attributes);
15152
+ }
15153
+ if (capturedContext !== void 0) {
15154
+ span.setAttribute(
15155
+ ATTR3.CAUSAL_POST_RESPONSE_ASYNC,
15156
+ capturedContext.traceId
15157
+ );
15158
+ span.setAttribute(ATTR3.CAUSAL_AFFECTS_HTTP_STATUS, false);
15159
+ span.setAttribute(ATTR3.CAUSAL_AFFECTS_HTTP_DURATION, false);
15160
+ }
15161
+ } catch {
15162
+ }
15163
+ try {
15164
+ const value = await context.with(
15165
+ trace.setSpan(context.active(), span),
15166
+ fn
15167
+ );
15168
+ return value;
15169
+ } catch (error48) {
15170
+ recordSpanError2(span, error48);
15171
+ throw error48;
15172
+ } finally {
15173
+ endSpanSafely2(span);
15174
+ }
15175
+ };
15176
+ }
15177
+ function isNoopSpan2(span) {
15178
+ try {
15179
+ return span.spanContext().traceId === INVALID_TRACE_ID2;
15180
+ } catch {
15181
+ return false;
15182
+ }
15183
+ }
15184
+ function recordSpanError2(span, error48) {
15185
+ const normalized = error48 instanceof Error ? error48 : typeof error48 === "string" ? error48 : new Error(String(error48));
15186
+ const statusMessage = normalized instanceof Error ? normalized.message : normalized;
15187
+ try {
15188
+ span.recordException(normalized);
15189
+ } catch {
15190
+ }
15191
+ try {
15192
+ span.setStatus({ code: SpanStatusCode.ERROR, message: statusMessage });
15193
+ } catch {
15194
+ }
15195
+ }
15196
+ function endSpanSafely2(span) {
15197
+ try {
15198
+ span.end();
15199
+ } catch {
15200
+ }
15201
+ }
14935
15202
  // Annotate the CommonJS export names for ESM import in node:
14936
15203
  0 && (module.exports = {
14937
15204
  GlasstraceSpanProcessor,
14938
15205
  SdkError,
14939
- captureCorrelationId
15206
+ captureCorrelationId,
15207
+ tracedRequestMiddleware,
15208
+ withAsyncCausality
14940
15209
  });
14941
15210
  //# sourceMappingURL=edge-entry.cjs.map