@mastra/observability 1.17.9-alpha.0 → 1.17.9-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
@@ -4988,7 +4988,12 @@ var BaseObservabilityInstance = class extends MastraBase {
4988
4988
  for (const processor of this.spanOutputProcessors) {
4989
4989
  if (!span) break;
4990
4990
  try {
4991
- span = processor.process(span);
4991
+ const processed = processor.process(span);
4992
+ if (processed !== void 0 && processed !== span) {
4993
+ this.logger.error(`[Observability] Processor error [name=${processor.name}]: process() must return the span it received (or undefined to drop it), not a copy. Span dropped.`);
4994
+ return;
4995
+ }
4996
+ span = processed;
4992
4997
  } catch (error) {
4993
4998
  this.logger.error(`[Observability] Processor error [name=${processor.name}]`, error);
4994
4999
  }
@@ -9288,9 +9293,10 @@ var SensitiveDataFilter = class {
9288
9293
  /**
9289
9294
  * Process a span by filtering sensitive data across its key fields.
9290
9295
  * Fields processed: attributes, metadata, input, output, errorInfo, requestContext.
9296
+ * The span is mutated in place, as the SpanOutputProcessor contract requires.
9291
9297
  *
9292
9298
  * @param span - The input span to filter
9293
- * @returns A new span with sensitive values redacted
9299
+ * @returns The same span instance with sensitive values redacted
9294
9300
  */
9295
9301
  process(span) {
9296
9302
  const indexedState = this.redactionStyle === "indexed" ? this.getTraceState(span.traceId) : void 0;