@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.js CHANGED
@@ -9185,7 +9185,7 @@ var SensitiveDataFilter = class {
9185
9185
  }
9186
9186
  /**
9187
9187
  * Process a span by filtering sensitive data across its key fields.
9188
- * Fields processed: attributes, metadata, input, output, errorInfo.
9188
+ * Fields processed: attributes, metadata, input, output, errorInfo, requestContext.
9189
9189
  *
9190
9190
  * @param span - The input span to filter
9191
9191
  * @returns A new span with sensitive values redacted
@@ -9197,6 +9197,7 @@ var SensitiveDataFilter = class {
9197
9197
  span.input = this.tryFilter(span.input, indexedState);
9198
9198
  span.output = this.tryFilter(span.output, indexedState);
9199
9199
  span.errorInfo = this.tryFilter(span.errorInfo, indexedState);
9200
+ span.requestContext = this.tryFilter(span.requestContext, indexedState);
9200
9201
  return span;
9201
9202
  }
9202
9203
  /**
@@ -9209,7 +9210,8 @@ var SensitiveDataFilter = class {
9209
9210
  if (state) this.traceStates.delete(traceId);
9210
9211
  else state = {
9211
9212
  tokensByValue: /* @__PURE__ */ new Map(),
9212
- counters: /* @__PURE__ */ new Map()
9213
+ counters: /* @__PURE__ */ new Map(),
9214
+ issuedTokens: /* @__PURE__ */ new Set()
9213
9215
  };
9214
9216
  this.traceStates.set(traceId, state);
9215
9217
  while (this.traceStates.size > MAX_TRACKED_TRACES) {
@@ -9307,6 +9309,7 @@ var SensitiveDataFilter = class {
9307
9309
  return str.slice(0, 3) + "…" + str.slice(len - 3);
9308
9310
  }
9309
9311
  if (this.redactionStyle === "indexed" && indexedState) {
9312
+ if (typeof value === "string" && indexedState.issuedTokens.has(value)) return value;
9310
9313
  const valueKey = createHash("sha256").update(String(value)).digest("hex");
9311
9314
  const existing = indexedState.tokensByValue.get(valueKey);
9312
9315
  if (existing) return existing;
@@ -9316,6 +9319,7 @@ var SensitiveDataFilter = class {
9316
9319
  indexedState.counters.set(label, count);
9317
9320
  const token = `[${label}_${count}]`;
9318
9321
  indexedState.tokensByValue.set(valueKey, token);
9322
+ indexedState.issuedTokens.add(token);
9319
9323
  return token;
9320
9324
  }
9321
9325
  return this.redactionToken;