bitfab 0.52.6 → 0.53.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BitfabError
3
- } from "./chunk-GJKU7VWG.js";
3
+ } from "./chunk-CBRO6BP7.js";
4
4
 
5
5
  // src/codeChange.ts
6
6
  var NUL = String.fromCharCode(0);
@@ -207,7 +207,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
207
207
  sessionId: seedCase.sessionId
208
208
  })
209
209
  );
210
- const { flushTraces: flushTraces2 } = await import("./http-ER2NMEKI.js");
210
+ const { flushTraces: flushTraces2 } = await import("./http-KP7DVTOD.js");
211
211
  await flushTraces2(3e4);
212
212
  return { pipeline, traceFunctionKey, traceIds };
213
213
  }
@@ -744,4 +744,4 @@ export {
744
744
  runRegistryMain,
745
745
  runIfEntrypoint
746
746
  };
747
- //# sourceMappingURL=chunk-5KVK733P.js.map
747
+ //# sourceMappingURL=chunk-DTC6SIXW.js.map
@@ -19,7 +19,7 @@ import {
19
19
  serializeValue,
20
20
  toJsonSafe,
21
21
  toJsonSafeReport
22
- } from "./chunk-DRTHTSHO.js";
22
+ } from "./chunk-SJKWUQ3G.js";
23
23
  import {
24
24
  BitfabError,
25
25
  DEFAULT_SERVICE_URL,
@@ -31,7 +31,7 @@ import {
31
31
  recordCallerTraceMetadata,
32
32
  retireTraceMetadata,
33
33
  warnOnce
34
- } from "./chunk-NXC6NYIY.js";
34
+ } from "./chunk-6IMGAODW.js";
35
35
  import {
36
36
  __privateAdd,
37
37
  __privateGet,
@@ -3177,6 +3177,26 @@ var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
3177
3177
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
3178
3178
  var AUTO_TRACE_POLICY_REFRESH_MS = 6e4;
3179
3179
  var AUTO_TRACE_POLICY_RETRY_MS = 1e4;
3180
+ function spanOwnerName(receiver) {
3181
+ if (typeof receiver === "function") {
3182
+ return receiver.name !== "" ? receiver.name : void 0;
3183
+ }
3184
+ if (typeof receiver !== "object" || receiver === null) {
3185
+ return void 0;
3186
+ }
3187
+ const owner = receiver.constructor;
3188
+ if (typeof owner !== "function" || owner === Object || owner.name === "") {
3189
+ return void 0;
3190
+ }
3191
+ return owner.name;
3192
+ }
3193
+ function qualifiedSpanName(receiver, functionName) {
3194
+ if (functionName === void 0) {
3195
+ return void 0;
3196
+ }
3197
+ const owner = spanOwnerName(receiver);
3198
+ return owner === void 0 ? functionName : `${owner}.${functionName}`;
3199
+ }
3180
3200
  function autoTraceLimit(value, fallback) {
3181
3201
  return value !== void 0 && Number.isFinite(value) && value >= 0 ? Math.floor(value) : fallback;
3182
3202
  }
@@ -3379,12 +3399,13 @@ var Bitfab = class {
3379
3399
  );
3380
3400
  const excluded = new Set(options.exclude ?? []);
3381
3401
  const includeWrappers = options.includeWrappers ?? false;
3402
+ const rootNameFor = (receiver) => options.name ?? (fn.name !== "" ? qualifiedSpanName(receiver, name) ?? name : name);
3382
3403
  const rootOptions = {
3383
- name: options.name ?? name,
3404
+ name: options.name,
3405
+ nameFor: rootNameFor,
3384
3406
  type: options.type ?? "custom",
3385
3407
  surface: "opt-out"
3386
3408
  };
3387
- const rootName = options.name ?? name;
3388
3409
  const buildTracedRoot = (spanOptions) => this.withSpan(
3389
3410
  traceFunctionKey,
3390
3411
  spanOptions,
@@ -3524,6 +3545,7 @@ var Bitfab = class {
3524
3545
  return tracedRoot.apply(this, args);
3525
3546
  }
3526
3547
  const link = getReplayContext() || inSeedScope() ? void 0 : { traceFunctionKey };
3548
+ const rootName = rootNameFor(this);
3527
3549
  return invokeThroughAutoTraceEntries(
3528
3550
  enclosing,
3529
3551
  (entry, next) => entry.context.invokeNestedRoot(
@@ -4190,7 +4212,7 @@ var Bitfab = class {
4190
4212
  const baseSpanParams = {
4191
4213
  traceFunctionKey,
4192
4214
  functionName,
4193
- spanName: options.name ?? functionName ?? traceFunctionKey,
4215
+ spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionName) ?? traceFunctionKey,
4194
4216
  traceId,
4195
4217
  spanId,
4196
4218
  parentSpanId,
@@ -4902,7 +4924,7 @@ var Bitfab = class {
4902
4924
  await runWithSeedContext({ traceId }, async () => target(...args));
4903
4925
  } finally {
4904
4926
  try {
4905
- const { flushTraces: flushTraces2 } = await import("./http-MGES3ZVX.js");
4927
+ const { flushTraces: flushTraces2 } = await import("./http-SEN3PUXX.js");
4906
4928
  await flushTraces2(3e4);
4907
4929
  } finally {
4908
4930
  unrecorded = activeTraceStates.delete(traceId);
@@ -4961,7 +4983,7 @@ var Bitfab = class {
4961
4983
  `Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
4962
4984
  );
4963
4985
  }
4964
- const { replay: doReplay } = await import("./replay-5XES2LBL.js");
4986
+ const { replay: doReplay } = await import("./replay-Y5RIJOWE.js");
4965
4987
  return doReplay(
4966
4988
  this.httpClient,
4967
4989
  this.serviceUrl,
@@ -5245,7 +5267,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
5245
5267
  sessionId: seedCase.sessionId
5246
5268
  })
5247
5269
  );
5248
- const { flushTraces: flushTraces2 } = await import("./http-MGES3ZVX.js");
5270
+ const { flushTraces: flushTraces2 } = await import("./http-SEN3PUXX.js");
5249
5271
  await flushTraces2(3e4);
5250
5272
  return { pipeline, traceFunctionKey, traceIds };
5251
5273
  }
@@ -5282,4 +5304,4 @@ export {
5282
5304
  reseedFromRegistry,
5283
5305
  seedFromRegistry
5284
5306
  };
5285
- //# sourceMappingURL=chunk-P26KVTI5.js.map
5307
+ //# sourceMappingURL=chunk-SCXR43UF.js.map