bitfab 0.54.3 → 0.54.4

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
@@ -1,3 +1,17 @@
1
+ declare class TraceCompletion {
2
+ private readonly traces;
3
+ private readonly closed;
4
+ private state;
5
+ start(traceId: string, spanId: string): void;
6
+ open(traceId: string): void;
7
+ hold(traceId: string, key: string): void;
8
+ record(traceId: string, spanId: string): void;
9
+ end(traceId: string, spanId: string): void;
10
+ abort(traceId: string, spanId: string): void;
11
+ close(traceId: string, complete: (count: number) => void, dropped?: boolean): void;
12
+ private drain;
13
+ }
14
+
1
15
  /**
2
16
  * Per-trace database snapshot ref capture.
3
17
  *
@@ -327,14 +341,6 @@ interface SimulationPlanResponse {
327
341
  }
328
342
  type SimulationPlanSubmit = (payload: Record<string, unknown>) => void;
329
343
 
330
- /**
331
- * HTTP client utilities for Bitfab API requests.
332
- *
333
- * This module provides:
334
- * - HttpClient class for making API requests
335
- * - awaitOnExit helper so deferred span work still gates process exit
336
- */
337
-
338
344
  /**
339
345
  * Wait for pending fire-and-forget requests AND every live span transport to
340
346
  * deliver, within one total deadline. Useful in tests and scripts to ensure all
@@ -407,6 +413,7 @@ declare class HttpClient {
407
413
  private traceTransport;
408
414
  private readonly traceDeliveries;
409
415
  private readonly deferredWork;
416
+ readonly traceCompletion: TraceCompletion;
410
417
  private closed;
411
418
  private closing;
412
419
  externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
@@ -547,6 +554,7 @@ declare class HttpClient {
547
554
  * server-authoritative barrier in `replay.ts`, not by awaiting this call.
548
555
  */
549
556
  sendExternalTrace(rawPayload: Record<string, unknown>): void;
557
+ private sendCountedExternalTrace;
550
558
  submitExternalTrace(payload: Record<string, unknown>): void;
551
559
  /**
552
560
  * Partial update of an existing trace identified by its Bitfab trace ID.
@@ -2235,6 +2243,7 @@ interface Trace {
2235
2243
  toJSON(): unknown;
2236
2244
  }
2237
2245
  interface Span<_T = any> {
2246
+ spanId?: string;
2238
2247
  traceId?: string;
2239
2248
  toJSON(): unknown;
2240
2249
  spanData?: {
@@ -2323,11 +2332,14 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
2323
2332
  * since the parent withSpan handles completion.
2324
2333
  */
2325
2334
  onTraceEnd(trace: Trace): Promise<void>;
2335
+ private readonly startedSpans;
2336
+ private readonly endedTraces;
2337
+ private cleanupTrace;
2326
2338
  /**
2327
2339
  * Called when a span is started. Span payloads are authoritative completed
2328
2340
  * snapshots, so start notifications do not cross the transport boundary.
2329
2341
  */
2330
- onSpanStart(_span: Span<any>): Promise<void>;
2342
+ onSpanStart(span: Span<any>): Promise<void>;
2331
2343
  /**
2332
2344
  * Called when a span is ended.
2333
2345
  *
@@ -3379,7 +3391,7 @@ interface CommitRef {
3379
3391
  /**
3380
3392
  * SDK version from package.json (injected at build time)
3381
3393
  */
3382
- declare const __version__ = "0.54.3";
3394
+ declare const __version__ = "0.54.4";
3383
3395
 
3384
3396
  /**
3385
3397
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,17 @@
1
+ declare class TraceCompletion {
2
+ private readonly traces;
3
+ private readonly closed;
4
+ private state;
5
+ start(traceId: string, spanId: string): void;
6
+ open(traceId: string): void;
7
+ hold(traceId: string, key: string): void;
8
+ record(traceId: string, spanId: string): void;
9
+ end(traceId: string, spanId: string): void;
10
+ abort(traceId: string, spanId: string): void;
11
+ close(traceId: string, complete: (count: number) => void, dropped?: boolean): void;
12
+ private drain;
13
+ }
14
+
1
15
  /**
2
16
  * Per-trace database snapshot ref capture.
3
17
  *
@@ -327,14 +341,6 @@ interface SimulationPlanResponse {
327
341
  }
328
342
  type SimulationPlanSubmit = (payload: Record<string, unknown>) => void;
329
343
 
330
- /**
331
- * HTTP client utilities for Bitfab API requests.
332
- *
333
- * This module provides:
334
- * - HttpClient class for making API requests
335
- * - awaitOnExit helper so deferred span work still gates process exit
336
- */
337
-
338
344
  /**
339
345
  * Wait for pending fire-and-forget requests AND every live span transport to
340
346
  * deliver, within one total deadline. Useful in tests and scripts to ensure all
@@ -407,6 +413,7 @@ declare class HttpClient {
407
413
  private traceTransport;
408
414
  private readonly traceDeliveries;
409
415
  private readonly deferredWork;
416
+ readonly traceCompletion: TraceCompletion;
410
417
  private closed;
411
418
  private closing;
412
419
  externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
@@ -547,6 +554,7 @@ declare class HttpClient {
547
554
  * server-authoritative barrier in `replay.ts`, not by awaiting this call.
548
555
  */
549
556
  sendExternalTrace(rawPayload: Record<string, unknown>): void;
557
+ private sendCountedExternalTrace;
550
558
  submitExternalTrace(payload: Record<string, unknown>): void;
551
559
  /**
552
560
  * Partial update of an existing trace identified by its Bitfab trace ID.
@@ -2235,6 +2243,7 @@ interface Trace {
2235
2243
  toJSON(): unknown;
2236
2244
  }
2237
2245
  interface Span<_T = any> {
2246
+ spanId?: string;
2238
2247
  traceId?: string;
2239
2248
  toJSON(): unknown;
2240
2249
  spanData?: {
@@ -2323,11 +2332,14 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
2323
2332
  * since the parent withSpan handles completion.
2324
2333
  */
2325
2334
  onTraceEnd(trace: Trace): Promise<void>;
2335
+ private readonly startedSpans;
2336
+ private readonly endedTraces;
2337
+ private cleanupTrace;
2326
2338
  /**
2327
2339
  * Called when a span is started. Span payloads are authoritative completed
2328
2340
  * snapshots, so start notifications do not cross the transport boundary.
2329
2341
  */
2330
- onSpanStart(_span: Span<any>): Promise<void>;
2342
+ onSpanStart(span: Span<any>): Promise<void>;
2331
2343
  /**
2332
2344
  * Called when a span is ended.
2333
2345
  *
@@ -3379,7 +3391,7 @@ interface CommitRef {
3379
3391
  /**
3380
3392
  * SDK version from package.json (injected at build time)
3381
3393
  */
3382
- declare const __version__ = "0.54.3";
3394
+ declare const __version__ = "0.54.4";
3383
3395
 
3384
3396
  /**
3385
3397
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  getCurrentTrace,
30
30
  reseedFromRegistry,
31
31
  seedFromRegistry
32
- } from "./chunk-PELZFWPC.js";
32
+ } from "./chunk-WFNCKWDC.js";
33
33
  import "./chunk-EGWJYCNT.js";
34
34
  import {
35
35
  BITFAB_PROGRESS_PREFIX,
@@ -38,7 +38,7 @@ import {
38
38
  ReplayError,
39
39
  reportReplayProgress,
40
40
  serializeReplayResult
41
- } from "./chunk-DL4KHJON.js";
41
+ } from "./chunk-YO332W7L.js";
42
42
  import {
43
43
  BitfabError,
44
44
  DEFAULT_SERVICE_URL,
@@ -46,7 +46,7 @@ import {
46
46
  MixedTracingError,
47
47
  __version__,
48
48
  flushTraces
49
- } from "./chunk-ZO4NEEUA.js";
49
+ } from "./chunk-UJRT3MLT.js";
50
50
  import "./chunk-VCRFFCLY.js";
51
51
  export {
52
52
  AssertionCategoriesClient,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.54.3";
100
+ __version__ = "0.54.4";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -112,6 +112,99 @@ var init_constants = __esm({
112
112
  }
113
113
  });
114
114
 
115
+ // src/traceCompletion.ts
116
+ var TraceCompletion;
117
+ var init_traceCompletion = __esm({
118
+ "src/traceCompletion.ts"() {
119
+ "use strict";
120
+ TraceCompletion = class {
121
+ constructor() {
122
+ this.traces = /* @__PURE__ */ new Map();
123
+ this.closed = /* @__PURE__ */ new Map();
124
+ }
125
+ state(traceId) {
126
+ let state = this.traces.get(traceId);
127
+ if (state === void 0) {
128
+ state = { spanIds: /* @__PURE__ */ new Set(), active: /* @__PURE__ */ new Set() };
129
+ this.traces.set(traceId, state);
130
+ }
131
+ return state;
132
+ }
133
+ start(traceId, spanId) {
134
+ if (this.closed.has(traceId)) {
135
+ return;
136
+ }
137
+ const state = this.state(traceId);
138
+ state.spanIds.add(spanId);
139
+ state.active.add(spanId);
140
+ }
141
+ open(traceId) {
142
+ if (!this.closed.has(traceId)) {
143
+ this.state(traceId);
144
+ }
145
+ }
146
+ hold(traceId, key) {
147
+ this.state(traceId).active.add(key);
148
+ }
149
+ record(traceId, spanId) {
150
+ if (!this.closed.has(traceId)) {
151
+ this.state(traceId).spanIds.add(spanId);
152
+ }
153
+ }
154
+ end(traceId, spanId) {
155
+ const state = this.traces.get(traceId);
156
+ if (state !== void 0) {
157
+ state.active.delete(spanId);
158
+ this.drain(traceId, state);
159
+ }
160
+ }
161
+ abort(traceId, spanId) {
162
+ const state = this.traces.get(traceId);
163
+ if (state === void 0) {
164
+ return;
165
+ }
166
+ state.active.delete(spanId);
167
+ state.spanIds.delete(spanId);
168
+ if (state.active.size === 0 && state.spanIds.size === 0 && state.complete === void 0) {
169
+ this.traces.delete(traceId);
170
+ return;
171
+ }
172
+ this.drain(traceId, state);
173
+ }
174
+ close(traceId, complete, dropped = false) {
175
+ const count = this.closed.get(traceId);
176
+ if (count !== void 0) {
177
+ complete(count);
178
+ return;
179
+ }
180
+ const state = this.traces.get(traceId);
181
+ if (state === void 0) {
182
+ return;
183
+ }
184
+ state.complete = complete;
185
+ if (dropped) {
186
+ state.active.clear();
187
+ }
188
+ this.drain(traceId, state);
189
+ }
190
+ drain(traceId, state) {
191
+ if (state.active.size !== 0 || state.complete === void 0) {
192
+ return;
193
+ }
194
+ this.traces.delete(traceId);
195
+ this.closed.set(traceId, state.spanIds.size);
196
+ if (this.closed.size > 1024) {
197
+ const oldest = this.closed.keys().next().value;
198
+ if (oldest !== void 0) {
199
+ this.closed.delete(oldest);
200
+ }
201
+ }
202
+ state.complete(state.spanIds.size);
203
+ }
204
+ };
205
+ }
206
+ });
207
+
115
208
  // src/readEnv.ts
116
209
  function readEnv(name) {
117
210
  if (typeof process !== "undefined" && process.env) {
@@ -2159,6 +2252,7 @@ var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, REPLAY_COMPLETE_REQUEST_TIMEOUT_MS, OTL
2159
2252
  var init_http = __esm({
2160
2253
  "src/http.ts"() {
2161
2254
  "use strict";
2255
+ init_traceCompletion();
2162
2256
  init_compress();
2163
2257
  init_constants();
2164
2258
  init_errors();
@@ -2221,6 +2315,7 @@ var init_http = __esm({
2221
2315
  // must not wait on another client's slow finalize: a false `close()` failure
2222
2316
  // caused by unrelated work is worse than no signal at all.
2223
2317
  this.deferredWork = /* @__PURE__ */ new Set();
2318
+ this.traceCompletion = new TraceCompletion();
2224
2319
  this.closed = false;
2225
2320
  this.apiKey = config.apiKey;
2226
2321
  this.serviceUrl = config.serviceUrl;
@@ -2654,6 +2749,10 @@ var init_http = __esm({
2654
2749
  );
2655
2750
  }
2656
2751
  sendExternalSpan(payload) {
2752
+ const ref2 = carrierRef(payload);
2753
+ if (ref2?.spanId !== void 0) {
2754
+ this.traceCompletion.record(ref2.traceId, ref2.spanId);
2755
+ }
2657
2756
  const gate = this.externalSpanTransform;
2658
2757
  if (gate === void 0) {
2659
2758
  this.submitExternalSpan(payload);
@@ -2685,13 +2784,28 @@ var init_http = __esm({
2685
2784
  */
2686
2785
  sendExternalTrace(rawPayload) {
2687
2786
  const payload = mergeCallerMetadataIntoTracePayload(rawPayload);
2688
- const gate = this.externalTraceTransform;
2689
- if (gate === void 0) {
2690
- this.submitExternalTrace(payload);
2787
+ const traceId = sourceTraceIdOf(payload);
2788
+ if (payload.completed === true && traceId !== void 0) {
2789
+ this.traceCompletion.close(
2790
+ traceId,
2791
+ (expectedSpanCount) => this.sendCountedExternalTrace({ ...payload, expectedSpanCount }),
2792
+ payload.dropped === true
2793
+ );
2691
2794
  return;
2692
2795
  }
2796
+ if (traceId !== void 0) {
2797
+ this.traceCompletion.open(traceId);
2798
+ }
2799
+ this.sendCountedExternalTrace(payload);
2800
+ }
2801
+ sendCountedExternalTrace(payload) {
2693
2802
  try {
2694
- gate(payload, (ready) => this.submitExternalTrace(ready));
2803
+ const gate = this.externalTraceTransform;
2804
+ if (gate === void 0) {
2805
+ this.submitExternalTrace(payload);
2806
+ } else {
2807
+ gate(payload, (ready) => this.submitExternalTrace(ready));
2808
+ }
2695
2809
  } catch (error) {
2696
2810
  warnDroppedExternalTrace(error);
2697
2811
  }
@@ -4517,6 +4631,7 @@ var BitfabClaudeAgentHandler = class {
4517
4631
  spanInfo.dropped = [...inputDropped];
4518
4632
  }
4519
4633
  this.runToSpan.set(spanId, spanInfo);
4634
+ this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
4520
4635
  return spanInfo;
4521
4636
  }
4522
4637
  completeSpan(spanId, output, error, extraContexts) {
@@ -4538,6 +4653,7 @@ var BitfabClaudeAgentHandler = class {
4538
4653
  spanInfo.contexts.push(extraContexts);
4539
4654
  }
4540
4655
  this.sendSpan(spanInfo);
4656
+ this.httpClient.traceCompletion.end(spanInfo.traceId, spanInfo.spanId);
4541
4657
  }
4542
4658
  sendSpan(spanInfo) {
4543
4659
  const spanData = {
@@ -6195,6 +6311,9 @@ var BitfabLangGraphCallbackHandler = class {
6195
6311
  spanInfo.hidden = true;
6196
6312
  }
6197
6313
  this.runToSpan.set(runId, spanInfo);
6314
+ if (spanInfo.hidden !== true) {
6315
+ this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
6316
+ }
6198
6317
  if (isRootInvocation) {
6199
6318
  this.sendTraceStart(spanInfo);
6200
6319
  }
@@ -6226,6 +6345,7 @@ var BitfabLangGraphCallbackHandler = class {
6226
6345
  this.sendTraceCompletion(spanInfo, invocation?.activeContext ?? null);
6227
6346
  this.invocations.delete(runId);
6228
6347
  }
6348
+ this.httpClient.traceCompletion.end(spanInfo.traceId, spanInfo.spanId);
6229
6349
  }
6230
6350
  sendSpan(spanInfo) {
6231
6351
  const spanData = {
@@ -6947,6 +7067,8 @@ var BitfabOpenAITracingProcessor = class {
6947
7067
  this.activeTraces = {};
6948
7068
  this.activeSpanMappings = {};
6949
7069
  this.canonicalTraceIds = {};
7070
+ this.startedSpans = /* @__PURE__ */ new Map();
7071
+ this.endedTraces = /* @__PURE__ */ new Set();
6950
7072
  this.ownsHttpClient = config._httpClient === void 0;
6951
7073
  this.httpClient = config._httpClient ?? new HttpClient({
6952
7074
  apiKey: config.apiKey,
@@ -6985,6 +7107,10 @@ var BitfabOpenAITracingProcessor = class {
6985
7107
  }
6986
7108
  const canonicalTraceId = activeContext?.traceId ?? this.getCanonicalTraceId(trace.traceId);
6987
7109
  this.canonicalTraceIds[trace.traceId] = canonicalTraceId;
7110
+ this.httpClient.traceCompletion.hold(
7111
+ activeContext?.traceId ?? trace.traceId,
7112
+ `openai:${trace.traceId}`
7113
+ );
6988
7114
  this.sendTrace(trace, {
6989
7115
  id: canonicalTraceId,
6990
7116
  sourceTraceId: activeContext?.traceId
@@ -7002,16 +7128,33 @@ var BitfabOpenAITracingProcessor = class {
7002
7128
  id: mapping?.traceId ?? this.getCanonicalTraceId(trace.traceId),
7003
7129
  sourceTraceId: mapping?.traceId
7004
7130
  });
7005
- delete this.activeSpanMappings[trace.traceId];
7006
- delete this.canonicalTraceIds[trace.traceId];
7007
- delete this.activeTraces[trace.traceId];
7131
+ this.endedTraces.add(trace.traceId);
7132
+ this.httpClient.traceCompletion.end(
7133
+ mapping?.traceId ?? trace.traceId,
7134
+ `openai:${trace.traceId}`
7135
+ );
7136
+ this.cleanupTrace(trace.traceId);
7137
+ }
7138
+ cleanupTrace(traceId) {
7139
+ if (!this.endedTraces.has(traceId) || [...this.startedSpans.values()].includes(traceId)) {
7140
+ return;
7141
+ }
7142
+ this.endedTraces.delete(traceId);
7143
+ delete this.activeSpanMappings[traceId];
7144
+ delete this.canonicalTraceIds[traceId];
7145
+ delete this.activeTraces[traceId];
7008
7146
  }
7009
7147
  /**
7010
7148
  * Called when a span is started. Span payloads are authoritative completed
7011
7149
  * snapshots, so start notifications do not cross the transport boundary.
7012
7150
  */
7013
7151
  // biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
7014
- async onSpanStart(_span) {
7152
+ async onSpanStart(span) {
7153
+ if (span.spanId !== void 0 && span.traceId !== null && span.traceId !== void 0) {
7154
+ this.startedSpans.set(span.spanId, span.traceId);
7155
+ const traceId = this.activeSpanMappings[span.traceId]?.traceId ?? span.traceId;
7156
+ this.httpClient.traceCompletion.start(traceId, span.spanId);
7157
+ }
7015
7158
  }
7016
7159
  /**
7017
7160
  * Called when a span is ended.
@@ -7020,7 +7163,17 @@ var BitfabOpenAITracingProcessor = class {
7020
7163
  */
7021
7164
  // biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
7022
7165
  async onSpanEnd(span) {
7023
- this.sendSpan(span);
7166
+ const originalTraceId = span.traceId ?? "";
7167
+ const traceId = this.activeSpanMappings[originalTraceId]?.traceId ?? originalTraceId;
7168
+ try {
7169
+ this.sendSpan(span);
7170
+ } finally {
7171
+ if (span.spanId !== void 0) {
7172
+ this.httpClient.traceCompletion.end(traceId, span.spanId);
7173
+ this.startedSpans.delete(span.spanId);
7174
+ }
7175
+ this.cleanupTrace(originalTraceId);
7176
+ }
7024
7177
  }
7025
7178
  /**
7026
7179
  * Called when a trace is being flushed.
@@ -8726,6 +8879,7 @@ var Bitfab = class {
8726
8879
  let newStack;
8727
8880
  let executeWithContext;
8728
8881
  let registeredTraceId;
8882
+ let startedSpan;
8729
8883
  try {
8730
8884
  const currentStack = getSpanStack();
8731
8885
  const parentContext = currentStack[currentStack.length - 1];
@@ -8777,6 +8931,8 @@ var Bitfab = class {
8777
8931
  });
8778
8932
  registeredTraceId = traceId;
8779
8933
  }
8934
+ self.httpClient.traceCompletion.start(traceId, spanId);
8935
+ startedSpan = { traceId, spanId };
8780
8936
  const functionName = fn.name !== "" ? fn.name : void 0;
8781
8937
  const rootTraceFunctionKey = activeTraceStates.get(traceId)?.traceFunctionKey ?? traceFunctionKey;
8782
8938
  const baseSpanParams = {
@@ -8851,6 +9007,8 @@ var Bitfab = class {
8851
9007
  retireTraceMetadata(traceId);
8852
9008
  }
8853
9009
  } catch {
9010
+ } finally {
9011
+ self.httpClient.traceCompletion.end(traceId, spanId);
8854
9012
  }
8855
9013
  };
8856
9014
  const recordSpan = (result) => {
@@ -8867,6 +9025,14 @@ var Bitfab = class {
8867
9025
  void sendSpan({ result });
8868
9026
  }
8869
9027
  };
9028
+ const resolveMockOrAbort = async (resolve) => {
9029
+ try {
9030
+ return await resolve();
9031
+ } catch (error) {
9032
+ self.httpClient.traceCompletion.abort(traceId, spanId);
9033
+ throw error;
9034
+ }
9035
+ };
8870
9036
  executeWithContext = () => {
8871
9037
  let result;
8872
9038
  try {
@@ -8923,7 +9089,7 @@ var Bitfab = class {
8923
9089
  );
8924
9090
  }
8925
9091
  return (async () => {
8926
- const output = await pending;
9092
+ const output = await resolveMockOrAbort(() => pending);
8927
9093
  void sendSpan({
8928
9094
  result: output,
8929
9095
  mocked: true,
@@ -8993,7 +9159,7 @@ var Bitfab = class {
8993
9159
  );
8994
9160
  }
8995
9161
  return runWithSpanStack(newStack, async () => {
8996
- const resolved2 = await resolution;
9162
+ const resolved2 = await resolveMockOrAbort(() => resolution);
8997
9163
  if (resolved2.matched) {
8998
9164
  void sendSpan({
8999
9165
  result: resolved2.output,
@@ -9009,7 +9175,9 @@ var Bitfab = class {
9009
9175
  );
9010
9176
  }
9011
9177
  if (shouldMockWithBaseStrategy) {
9012
- const output = await resolveRecordedOutput();
9178
+ const output = await resolveMockOrAbort(
9179
+ () => resolveRecordedOutput()
9180
+ );
9013
9181
  void sendSpan({
9014
9182
  result: output,
9015
9183
  mocked: true,
@@ -9039,6 +9207,12 @@ var Bitfab = class {
9039
9207
  }
9040
9208
  }
9041
9209
  } catch (setupError) {
9210
+ if (startedSpan) {
9211
+ self.httpClient.traceCompletion.abort(
9212
+ startedSpan.traceId,
9213
+ startedSpan.spanId
9214
+ );
9215
+ }
9042
9216
  if (registeredTraceId) {
9043
9217
  activeTraceStates.delete(registeredTraceId);
9044
9218
  retireTraceMetadata(registeredTraceId);