@bitfab/sdk 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.
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-7KIRLN47.js";
9
+ } from "./chunk-WIBQUZPU.js";
10
10
  import "./chunk-H6LZRFMN.js";
11
11
  export {
12
12
  BitfabError,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-EL26HG5B.js.map
20
+ //# sourceMappingURL=http-C4CWGASW.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-RC6XLP6M.js";
9
+ } from "./chunk-E3O64PDG.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-YMBQ4XJO.js.map
19
+ //# sourceMappingURL=http-NLURGVPA.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.52.6";
45
+ __version__ = "0.53.0";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -6878,6 +6878,26 @@ var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
6878
6878
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
6879
6879
  var AUTO_TRACE_POLICY_REFRESH_MS = 6e4;
6880
6880
  var AUTO_TRACE_POLICY_RETRY_MS = 1e4;
6881
+ function spanOwnerName(receiver) {
6882
+ if (typeof receiver === "function") {
6883
+ return receiver.name !== "" ? receiver.name : void 0;
6884
+ }
6885
+ if (typeof receiver !== "object" || receiver === null) {
6886
+ return void 0;
6887
+ }
6888
+ const owner = receiver.constructor;
6889
+ if (typeof owner !== "function" || owner === Object || owner.name === "") {
6890
+ return void 0;
6891
+ }
6892
+ return owner.name;
6893
+ }
6894
+ function qualifiedSpanName(receiver, functionName) {
6895
+ if (functionName === void 0) {
6896
+ return void 0;
6897
+ }
6898
+ const owner = spanOwnerName(receiver);
6899
+ return owner === void 0 ? functionName : `${owner}.${functionName}`;
6900
+ }
6881
6901
  function autoTraceLimit(value, fallback) {
6882
6902
  return value !== void 0 && Number.isFinite(value) && value >= 0 ? Math.floor(value) : fallback;
6883
6903
  }
@@ -7080,12 +7100,13 @@ var Bitfab = class {
7080
7100
  );
7081
7101
  const excluded = new Set(options.exclude ?? []);
7082
7102
  const includeWrappers = options.includeWrappers ?? false;
7103
+ const rootNameFor = (receiver) => options.name ?? (fn.name !== "" ? qualifiedSpanName(receiver, name) ?? name : name);
7083
7104
  const rootOptions = {
7084
- name: options.name ?? name,
7105
+ name: options.name,
7106
+ nameFor: rootNameFor,
7085
7107
  type: options.type ?? "custom",
7086
7108
  surface: "opt-out"
7087
7109
  };
7088
- const rootName = options.name ?? name;
7089
7110
  const buildTracedRoot = (spanOptions) => this.withSpan(
7090
7111
  traceFunctionKey,
7091
7112
  spanOptions,
@@ -7225,6 +7246,7 @@ var Bitfab = class {
7225
7246
  return tracedRoot.apply(this, args);
7226
7247
  }
7227
7248
  const link = getReplayContext() || inSeedScope() ? void 0 : { traceFunctionKey };
7249
+ const rootName = rootNameFor(this);
7228
7250
  return invokeThroughAutoTraceEntries(
7229
7251
  enclosing,
7230
7252
  (entry, next) => entry.context.invokeNestedRoot(
@@ -7891,7 +7913,7 @@ var Bitfab = class {
7891
7913
  const baseSpanParams = {
7892
7914
  traceFunctionKey,
7893
7915
  functionName,
7894
- spanName: options.name ?? functionName ?? traceFunctionKey,
7916
+ spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionName) ?? traceFunctionKey,
7895
7917
  traceId,
7896
7918
  spanId,
7897
7919
  parentSpanId,