@mastra/observability 1.17.6-alpha.0 → 1.17.6-alpha.1

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.cjs CHANGED
@@ -9210,7 +9210,7 @@ var SensitiveDataFilter = class {
9210
9210
  }
9211
9211
  /**
9212
9212
  * Process a span by filtering sensitive data across its key fields.
9213
- * Fields processed: attributes, metadata, input, output, errorInfo.
9213
+ * Fields processed: attributes, metadata, input, output, errorInfo, requestContext.
9214
9214
  *
9215
9215
  * @param span - The input span to filter
9216
9216
  * @returns A new span with sensitive values redacted
@@ -9222,6 +9222,7 @@ var SensitiveDataFilter = class {
9222
9222
  span.input = this.tryFilter(span.input, indexedState);
9223
9223
  span.output = this.tryFilter(span.output, indexedState);
9224
9224
  span.errorInfo = this.tryFilter(span.errorInfo, indexedState);
9225
+ span.requestContext = this.tryFilter(span.requestContext, indexedState);
9225
9226
  return span;
9226
9227
  }
9227
9228
  /**
@@ -9234,7 +9235,8 @@ var SensitiveDataFilter = class {
9234
9235
  if (state) this.traceStates.delete(traceId);
9235
9236
  else state = {
9236
9237
  tokensByValue: /* @__PURE__ */ new Map(),
9237
- counters: /* @__PURE__ */ new Map()
9238
+ counters: /* @__PURE__ */ new Map(),
9239
+ issuedTokens: /* @__PURE__ */ new Set()
9238
9240
  };
9239
9241
  this.traceStates.set(traceId, state);
9240
9242
  while (this.traceStates.size > MAX_TRACKED_TRACES) {
@@ -9332,6 +9334,7 @@ var SensitiveDataFilter = class {
9332
9334
  return str.slice(0, 3) + "…" + str.slice(len - 3);
9333
9335
  }
9334
9336
  if (this.redactionStyle === "indexed" && indexedState) {
9337
+ if (typeof value === "string" && indexedState.issuedTokens.has(value)) return value;
9335
9338
  const valueKey = (0, crypto$1.createHash)("sha256").update(String(value)).digest("hex");
9336
9339
  const existing = indexedState.tokensByValue.get(valueKey);
9337
9340
  if (existing) return existing;
@@ -9341,6 +9344,7 @@ var SensitiveDataFilter = class {
9341
9344
  indexedState.counters.set(label, count);
9342
9345
  const token = `[${label}_${count}]`;
9343
9346
  indexedState.tokensByValue.set(valueKey, token);
9347
+ indexedState.issuedTokens.add(token);
9344
9348
  return token;
9345
9349
  }
9346
9350
  return this.redactionToken;