@mastra/observability 1.21.0-alpha.2 → 1.21.1-alpha.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.js CHANGED
@@ -51,9 +51,7 @@ function routeToHandler(handler, event, logger) {
51
51
  }), handler.name, "score", logger);
52
52
  }
53
53
  break;
54
- case "feedback":
55
- if (handler.onFeedbackEvent) return catchAsyncResult(handler.onFeedbackEvent(event), handler.name, "feedback", logger);
56
- break;
54
+ case "feedback": if (handler.onFeedbackEvent) return catchAsyncResult(handler.onFeedbackEvent(event), handler.name, "feedback", logger);
57
55
  }
58
56
  } catch (err) {
59
57
  logger.error(`[Observability] Handler error [handler=${handler.name}]:`, err);
@@ -202,7 +200,7 @@ const VALUE_STRIP_KEYS = /* @__PURE__ */ new Set([
202
200
  const DEFAULT_DEEP_CLEAN_OPTIONS = Object.freeze({
203
201
  keysToStrip: [],
204
202
  maxDepth: 8,
205
- maxStringLength: 128 * 1024,
203
+ maxStringLength: 131072,
206
204
  maxArrayLength: 50,
207
205
  maxObjectKeys: 50
208
206
  });
@@ -1276,8 +1274,8 @@ function isRecord(value) {
1276
1274
  //#endregion
1277
1275
  //#region src/metrics/pricing-registry.ts
1278
1276
  const DATA_FILE_NAME = "pricing-data.json";
1279
- const REFRESH_INTERVAL_MS = 1440 * 60 * 1e3;
1280
- const MIN_REFRESH_ATTEMPT_INTERVAL_MS = 3600 * 1e3;
1277
+ const REFRESH_INTERVAL_MS = 864e5;
1278
+ const MIN_REFRESH_ATTEMPT_INTERVAL_MS = 36e5;
1281
1279
  const REFRESH_TIMEOUT_MS = 5e3;
1282
1280
  const CACHE_FILE = () => path.join(os.homedir(), ".cache", "mastra", "pricing-data.json");
1283
1281
  const CACHE_VERSION = 1;
@@ -2640,7 +2638,7 @@ var ModelSpanTracker = class {
2640
2638
  * Returns undefined if no step span is active.
2641
2639
  */
2642
2640
  exportCurrentStep() {
2643
- return this.#currentStepSpan?.exportSpan();
2641
+ return this.#currentStepSpan?.snapshot();
2644
2642
  }
2645
2643
  /**
2646
2644
  * Get the pending step finish payload (captured when defer mode is enabled).
@@ -2936,9 +2934,7 @@ var ModelSpanTracker = class {
2936
2934
  if (this.#currentChunkType !== "text") this.#startChunkSpan("text");
2937
2935
  this.#appendToAccumulator("text", chunk.payload.text);
2938
2936
  break;
2939
- case "text-end":
2940
- this.#endChunkSpan();
2941
- break;
2937
+ case "text-end": this.#endChunkSpan();
2942
2938
  }
2943
2939
  }
2944
2940
  /**
@@ -2953,9 +2949,7 @@ var ModelSpanTracker = class {
2953
2949
  if (this.#currentChunkType !== "reasoning") this.#startChunkSpan("reasoning");
2954
2950
  this.#appendToAccumulator("text", chunk.payload.text);
2955
2951
  break;
2956
- case "reasoning-end":
2957
- this.#endChunkSpan();
2958
- break;
2952
+ case "reasoning-end": this.#endChunkSpan();
2959
2953
  }
2960
2954
  }
2961
2955
  /**
@@ -2998,9 +2992,7 @@ var ModelSpanTracker = class {
2998
2992
  case "object":
2999
2993
  if (this.#currentChunkType !== "object") this.#startChunkSpan("object");
3000
2994
  break;
3001
- case "object-result":
3002
- this.#endChunkSpan(chunk.object);
3003
- break;
2995
+ case "object-result": this.#endChunkSpan(chunk.object);
3004
2996
  }
3005
2997
  }
3006
2998
  /**
@@ -3103,7 +3095,6 @@ var ModelSpanTracker = class {
3103
3095
  this.#createEventSpan(chunk.type, spanOutput, { metadata });
3104
3096
  break;
3105
3097
  }
3106
- default: break;
3107
3098
  }
3108
3099
  } }));
3109
3100
  }
@@ -3559,6 +3550,13 @@ var BaseSpan = class BaseSpan {
3559
3550
  ...this.isRootSpan && !nestedUnderParent && this.tags?.length ? { tags: this.tags } : {}
3560
3551
  };
3561
3552
  }
3553
+ /** Returns the span saved for a later `rebuildSpan()`, with its trace state */
3554
+ snapshot() {
3555
+ return {
3556
+ ...this.exportSpan(),
3557
+ ...this.traceState ? { traceState: this.traceState } : {}
3558
+ };
3559
+ }
3562
3560
  get externalTraceId() {
3563
3561
  return this.isValid ? this.traceId : void 0;
3564
3562
  }
@@ -3644,10 +3642,14 @@ var DefaultSpan = class extends BaseSpan {
3644
3642
  }
3645
3643
  this.traceId = getOrCreateTraceId(options);
3646
3644
  this.id = generateSpanId();
3647
- if (options.parentSpanId) if (isValidSpanId(options.parentSpanId)) this.parentSpanId = options.parentSpanId;
3648
- else console.error(`[Mastra Tracing] Invalid parentSpanId: must be 1-16 hexadecimal characters, got "${options.parentSpanId}". Ignoring.`);
3649
- if (options.externalParentSpanId) if (isValidSpanId(options.externalParentSpanId)) this.externalParentSpanId = options.externalParentSpanId;
3650
- else console.error(`[Mastra Tracing] Invalid externalParentSpanId: must be 1-16 hexadecimal characters, got "${options.externalParentSpanId}". Ignoring.`);
3645
+ if (options.parentSpanId) {
3646
+ if (isValidSpanId(options.parentSpanId)) this.parentSpanId = options.parentSpanId;
3647
+ else console.error(`[Mastra Tracing] Invalid parentSpanId: must be 1-16 hexadecimal characters, got "${options.parentSpanId}". Ignoring.`);
3648
+ }
3649
+ if (options.externalParentSpanId) {
3650
+ if (isValidSpanId(options.externalParentSpanId)) this.externalParentSpanId = options.externalParentSpanId;
3651
+ else console.error(`[Mastra Tracing] Invalid externalParentSpanId: must be 1-16 hexadecimal characters, got "${options.externalParentSpanId}". Ignoring.`);
3652
+ }
3651
3653
  }
3652
3654
  end(options) {
3653
3655
  if (this.isEvent) return;
@@ -3769,8 +3771,10 @@ function isValidSpanId(spanId) {
3769
3771
  return /^[0-9a-f]{1,16}$/i.test(spanId);
3770
3772
  }
3771
3773
  function getOrCreateTraceId(options) {
3772
- if (options.traceId) if (isValidTraceId(options.traceId)) return options.traceId;
3773
- else console.error(`[Mastra Tracing] Invalid traceId: must be 1-32 hexadecimal characters, got "${options.traceId}". Generating new trace ID.`);
3774
+ if (options.traceId) {
3775
+ if (isValidTraceId(options.traceId)) return options.traceId;
3776
+ else console.error(`[Mastra Tracing] Invalid traceId: must be 1-32 hexadecimal characters, got "${options.traceId}". Generating new trace ID.`);
3777
+ }
3774
3778
  return generateTraceId();
3775
3779
  }
3776
3780
  //#endregion
@@ -4019,17 +4023,13 @@ var EventBuffer = class {
4019
4023
  switch (this.#storageStrategy) {
4020
4024
  case "realtime":
4021
4025
  case "event-sourced":
4022
- case "batch-with-updates":
4023
- this.pushCreate(event);
4024
- break;
4026
+ case "batch-with-updates": this.pushCreate(event);
4025
4027
  }
4026
4028
  break;
4027
4029
  case TracingEventType.SPAN_UPDATED:
4028
4030
  switch (this.#storageStrategy) {
4029
4031
  case "realtime":
4030
- case "batch-with-updates":
4031
- this.pushUpdate(event);
4032
- break;
4032
+ case "batch-with-updates": this.pushUpdate(event);
4033
4033
  }
4034
4034
  break;
4035
4035
  case TracingEventType.SPAN_ENDED:
@@ -4039,14 +4039,10 @@ var EventBuffer = class {
4039
4039
  case "batch-with-updates":
4040
4040
  this.pushUpdate(event);
4041
4041
  break;
4042
- default:
4043
- this.pushCreate(event);
4044
- break;
4042
+ default: this.pushCreate(event);
4045
4043
  }
4046
4044
  break;
4047
- default:
4048
- this.pushCreate(event);
4049
- break;
4045
+ default: this.pushCreate(event);
4050
4046
  }
4051
4047
  }
4052
4048
  /** Re-add failed create events to the buffer, returning events that exceed max retries. */
@@ -4421,17 +4417,13 @@ var DefaultExporter = class extends BaseExporter {
4421
4417
  case "score":
4422
4418
  createScoreEvents.push(createEvent);
4423
4419
  break;
4424
- default:
4425
- createSpanEvents.push(createEvent);
4426
- break;
4420
+ default: createSpanEvents.push(createEvent);
4427
4421
  }
4428
4422
  for (const updateEvent of updates) switch (updateEvent.type) {
4429
4423
  case TracingEventType.SPAN_UPDATED:
4430
4424
  updateSpanEvents.push(updateEvent);
4431
4425
  break;
4432
- case TracingEventType.SPAN_ENDED:
4433
- endSpanEvents.push(updateEvent);
4434
- break;
4426
+ case TracingEventType.SPAN_ENDED: endSpanEvents.push(updateEvent);
4435
4427
  }
4436
4428
  const flushResults = await Promise.all([
4437
4429
  this.flushCreates("feedback", createFeedbackEvents, (events) => this.#observabilityStorage.batchCreateFeedback({ feedbacks: events.map((f) => buildFeedbackRecord(f)) })),
@@ -4448,13 +4440,15 @@ var DefaultExporter = class extends BaseExporter {
4448
4440
  flushResults.push(await this.flushSpanUpdates(updateSpanEvents, deferredUpdates, false));
4449
4441
  flushResults.push(await this.flushSpanUpdates(endSpanEvents, deferredUpdates, true));
4450
4442
  let deferredDropCount = 0;
4451
- if (deferredUpdates.length > 0) if (this.#unsupportedSignals.has("tracing")) {
4452
- deferredDropCount = deferredUpdates.length;
4453
- this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4454
- deferredUpdates.length = 0;
4455
- } else {
4456
- deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4457
- this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4443
+ if (deferredUpdates.length > 0) {
4444
+ if (this.#unsupportedSignals.has("tracing")) {
4445
+ deferredDropCount = deferredUpdates.length;
4446
+ this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4447
+ deferredUpdates.length = 0;
4448
+ } else {
4449
+ deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4450
+ this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4451
+ }
4458
4452
  }
4459
4453
  const retryAttempt = flushResults.reduce((earliestAttempt, result) => {
4460
4454
  if (result.retryAttempt === void 0) return earliestAttempt;
@@ -4872,17 +4866,13 @@ var MastraStorageExporter = class extends BaseExporter {
4872
4866
  case "score":
4873
4867
  createScoreEvents.push(createEvent);
4874
4868
  break;
4875
- default:
4876
- createSpanEvents.push(createEvent);
4877
- break;
4869
+ default: createSpanEvents.push(createEvent);
4878
4870
  }
4879
4871
  for (const updateEvent of updates) switch (updateEvent.type) {
4880
4872
  case TracingEventType.SPAN_UPDATED:
4881
4873
  updateSpanEvents.push(updateEvent);
4882
4874
  break;
4883
- case TracingEventType.SPAN_ENDED:
4884
- endSpanEvents.push(updateEvent);
4885
- break;
4875
+ case TracingEventType.SPAN_ENDED: endSpanEvents.push(updateEvent);
4886
4876
  }
4887
4877
  const flushResults = await Promise.all([
4888
4878
  this.flushCreates("feedback", createFeedbackEvents, (events) => this.#observabilityStorage.batchCreateFeedback({ feedbacks: events.map((f) => buildFeedbackRecord(f)) })),
@@ -4899,13 +4889,15 @@ var MastraStorageExporter = class extends BaseExporter {
4899
4889
  flushResults.push(await this.flushSpanUpdates(updateSpanEvents, deferredUpdates, false));
4900
4890
  flushResults.push(await this.flushSpanUpdates(endSpanEvents, deferredUpdates, true));
4901
4891
  let deferredDropCount = 0;
4902
- if (deferredUpdates.length > 0) if (this.#unsupportedSignals.has("tracing")) {
4903
- deferredDropCount = deferredUpdates.length;
4904
- this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4905
- deferredUpdates.length = 0;
4906
- } else {
4907
- deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4908
- this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4892
+ if (deferredUpdates.length > 0) {
4893
+ if (this.#unsupportedSignals.has("tracing")) {
4894
+ deferredDropCount = deferredUpdates.length;
4895
+ this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4896
+ deferredUpdates.length = 0;
4897
+ } else {
4898
+ deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4899
+ this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4900
+ }
4909
4901
  }
4910
4902
  const retryAttempt = flushResults.reduce((earliestAttempt, result) => {
4911
4903
  if (result.retryAttempt === void 0) return earliestAttempt;
@@ -5171,7 +5163,7 @@ var BaseObservabilityInstance = class extends MastraBase {
5171
5163
  * - Can have end(), update(), error() called on it
5172
5164
  * - Will emit SPAN_ENDED or SPAN_UPDATED when those methods are called
5173
5165
  *
5174
- * @param cached - The exported span data to rebuild from
5166
+ * @param cached - The span snapshot to rebuild from
5175
5167
  * @returns A span that can have lifecycle methods called on it
5176
5168
  */
5177
5169
  rebuildSpan(cached) {
@@ -5191,15 +5183,26 @@ var BaseObservabilityInstance = class extends MastraBase {
5191
5183
  entityId: cached.entityId,
5192
5184
  entityName: cached.entityName,
5193
5185
  tracingPolicy: cached.isInternal ? { internal: InternalSpans.ALL } : void 0,
5194
- traceState: cached.nestedUnderParent ? {
5195
- requestContextKeys: [],
5196
- nestedUnderParent: true
5197
- } : void 0
5186
+ traceState: this.rebuildTraceState(cached)
5198
5187
  });
5199
5188
  this.wireSpanLifecycle(span);
5200
5189
  return span;
5201
5190
  }
5202
5191
  /**
5192
+ * Restore the trace-level rules for a rebuilt span. Spans saved with
5193
+ * `exportSpan()` before `snapshot()` existed fall back to the instance's
5194
+ * configured keys, so an in-flight durable run keeps at least those across an upgrade.
5195
+ */
5196
+ rebuildTraceState(cached) {
5197
+ if (cached.traceState) return cached.traceState;
5198
+ const fallback = this.computeTraceState();
5199
+ if (!cached.nestedUnderParent) return fallback;
5200
+ return {
5201
+ requestContextKeys: fallback?.requestContextKeys ?? [],
5202
+ nestedUnderParent: true
5203
+ };
5204
+ }
5205
+ /**
5203
5206
  * Get current configuration
5204
5207
  */
5205
5208
  getConfig() {
@@ -5425,10 +5428,13 @@ var BaseObservabilityInstance = class extends MastraBase {
5425
5428
  const parts = key.split(".");
5426
5429
  const rootKey = parts[0];
5427
5430
  const value = requestContext.get(rootKey);
5428
- if (value !== void 0) if (parts.length > 1) {
5429
- const nestedValue = getNestedValue(value, parts.slice(1).join("."));
5430
- if (nestedValue !== void 0) setNestedValue(result, key, nestedValue);
5431
- } else setNestedValue(result, key, value);
5431
+ if (value !== void 0) {
5432
+ if (parts.length > 1) {
5433
+ const nestedPath = parts.slice(1).join(".");
5434
+ const nestedValue = getNestedValue(value, nestedPath);
5435
+ if (nestedValue !== void 0) setNestedValue(result, key, nestedValue);
5436
+ } else setNestedValue(result, key, value);
5437
+ }
5432
5438
  }
5433
5439
  return result;
5434
5440
  }
@@ -5976,7 +5982,7 @@ function formatBaggage(entries) {
5976
5982
  const DEFAULT_LIMITS = {
5977
5983
  maxSpans: 10,
5978
5984
  maxLogs: 10,
5979
- maxPayloadBytes: 1024 * 1024
5985
+ maxPayloadBytes: 1048576
5980
5986
  };
5981
5987
  var ClientObservabilityProxyImpl = class {
5982
5988
  #resolveInstance;
@@ -6911,36 +6917,38 @@ var TrackingExporter = class extends BaseExporter {
6911
6917
  method
6912
6918
  });
6913
6919
  const { exportedSpan } = await this._preExportTracingEvent(event);
6914
- if (!this.skipBuildRootTask && !traceData.hasRoot()) if (exportedSpan.isRootSpan) {
6915
- this.logger.debug(`${this.name}: Building root`, {
6916
- traceId: exportedSpan.traceId,
6917
- spanId: exportedSpan.id
6918
- });
6919
- const rootData = await this._buildRoot({
6920
- span: exportedSpan,
6921
- traceData
6922
- });
6923
- if (rootData) {
6924
- this.logger.debug(`${this.name}: Adding root`, {
6920
+ if (!this.skipBuildRootTask && !traceData.hasRoot()) {
6921
+ if (exportedSpan.isRootSpan) {
6922
+ this.logger.debug(`${this.name}: Building root`, {
6925
6923
  traceId: exportedSpan.traceId,
6926
6924
  spanId: exportedSpan.id
6927
6925
  });
6928
- traceData.addRoot({
6929
- rootId: exportedSpan.id,
6930
- rootData
6926
+ const rootData = await this._buildRoot({
6927
+ span: exportedSpan,
6928
+ traceData
6931
6929
  });
6932
- this.#scheduleProcessWaitingForRoot(traceId);
6930
+ if (rootData) {
6931
+ this.logger.debug(`${this.name}: Adding root`, {
6932
+ traceId: exportedSpan.traceId,
6933
+ spanId: exportedSpan.id
6934
+ });
6935
+ traceData.addRoot({
6936
+ rootId: exportedSpan.id,
6937
+ rootData
6938
+ });
6939
+ this.#scheduleProcessWaitingForRoot(traceId);
6940
+ }
6941
+ } else {
6942
+ this.logger.debug(`${this.name}: Root does not exist, adding span to waiting queue.`, {
6943
+ traceId: exportedSpan.traceId,
6944
+ spanId: exportedSpan.id
6945
+ });
6946
+ traceData.addToWaitingQueue({
6947
+ event,
6948
+ waitingFor: "root"
6949
+ });
6950
+ return;
6933
6951
  }
6934
- } else {
6935
- this.logger.debug(`${this.name}: Root does not exist, adding span to waiting queue.`, {
6936
- traceId: exportedSpan.traceId,
6937
- spanId: exportedSpan.id
6938
- });
6939
- traceData.addToWaitingQueue({
6940
- event,
6941
- waitingFor: "root"
6942
- });
6943
- return;
6944
6952
  }
6945
6953
  if (exportedSpan.metadata && this.name in exportedSpan.metadata) {
6946
6954
  const metadata = exportedSpan.metadata[this.name];
@@ -7067,7 +7075,6 @@ var TrackingExporter = class extends BaseExporter {
7067
7075
  traceData
7068
7076
  });
7069
7077
  if (traceData.activeSpanCount() === 0) this.#scheduleCleanup(traceId);
7070
- break;
7071
7078
  }
7072
7079
  } catch (error) {
7073
7080
  this.logger.error(`${this.name}: exporter error`, {
@@ -7233,7 +7240,7 @@ function chainFormatters(formatters) {
7233
7240
  //#region src/exporters/auth-failure-cooldown.ts
7234
7241
  const AUTH_FAILURE_STATUSES = /* @__PURE__ */ new Set([401, 403]);
7235
7242
  const AUTH_COOLDOWN_BASE_MS = 6e4;
7236
- const AUTH_COOLDOWN_MAX_MS = 15 * 6e4;
7243
+ const AUTH_COOLDOWN_MAX_MS = 9e5;
7237
7244
  const AUTH_COOLDOWN_JITTER_RATIO = .1;
7238
7245
  var AuthFailureError = class extends Error {
7239
7246
  status;
@@ -7662,8 +7669,9 @@ var CloudExporter = class extends BaseExporter {
7662
7669
  succeeded: false,
7663
7670
  authFailureStatus: error.status
7664
7671
  };
7672
+ const errorId = `CLOUD_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`;
7665
7673
  const mastraError = new MastraError({
7666
- id: `CLOUD_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`,
7674
+ id: errorId,
7667
7675
  domain: ErrorDomain.MASTRA_OBSERVABILITY,
7668
7676
  category: ErrorCategory.USER,
7669
7677
  details: {
@@ -8252,8 +8260,9 @@ var MastraPlatformExporter = class extends BaseExporter {
8252
8260
  succeeded: false,
8253
8261
  authFailureStatus: error.status
8254
8262
  };
8263
+ const errorId = `MASTRA_PLATFORM_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`;
8255
8264
  const mastraError = new MastraError({
8256
- id: `MASTRA_PLATFORM_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`,
8265
+ id: errorId,
8257
8266
  domain: ErrorDomain.MASTRA_OBSERVABILITY,
8258
8267
  category: ErrorCategory.USER,
8259
8268
  details: {
@@ -9117,16 +9126,18 @@ var TestExporter = class extends BaseExporter {
9117
9126
  for (let i = 0; i < maxLen; i++) {
9118
9127
  const actualLine = actual[i];
9119
9128
  const expectedLine = expected[i];
9120
- if (actualLine !== expectedLine) if (actualLine === void 0) {
9121
- diffs.push(`Line ${i + 1}: Missing in actual`);
9122
- diffs.push(` Expected: ${expectedLine}`);
9123
- } else if (expectedLine === void 0) {
9124
- diffs.push(`Line ${i + 1}: Extra in actual`);
9125
- diffs.push(` Actual: ${actualLine}`);
9126
- } else {
9127
- diffs.push(`Line ${i + 1}:`);
9128
- diffs.push(` Expected: ${expectedLine}`);
9129
- diffs.push(` Actual: ${actualLine}`);
9129
+ if (actualLine !== expectedLine) {
9130
+ if (actualLine === void 0) {
9131
+ diffs.push(`Line ${i + 1}: Missing in actual`);
9132
+ diffs.push(` Expected: ${expectedLine}`);
9133
+ } else if (expectedLine === void 0) {
9134
+ diffs.push(`Line ${i + 1}: Extra in actual`);
9135
+ diffs.push(` Actual: ${actualLine}`);
9136
+ } else {
9137
+ diffs.push(`Line ${i + 1}:`);
9138
+ diffs.push(` Expected: ${expectedLine}`);
9139
+ diffs.push(` Actual: ${actualLine}`);
9140
+ }
9130
9141
  }
9131
9142
  }
9132
9143
  return diffs;
@@ -9889,9 +9900,10 @@ var SensitiveDataFilter = class {
9889
9900
  const filtered = {};
9890
9901
  for (const key of Object.keys(obj)) {
9891
9902
  const normKey = this.normalizeKey(key);
9892
- if (this.isSensitive(normKey)) if (obj[key] && typeof obj[key] === "object") filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9893
- else filtered[key] = this.redactValue(obj[key], normKey, indexedState);
9894
- else filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9903
+ if (this.isSensitive(normKey)) {
9904
+ if (obj[key] && typeof obj[key] === "object") filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9905
+ else filtered[key] = this.redactValue(obj[key], normKey, indexedState);
9906
+ } else filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9895
9907
  }
9896
9908
  return filtered;
9897
9909
  }