He-Pin opened a new pull request, #3124: URL: https://github.com/apache/pekko/pull/3124
## Summary - Adds error logging when supervision strategy returns Resume or Restart for failed elements in `MapAsync`, `MapAsyncUnordered`, and `MapAsyncPartitioned` - Respects the `stage-errors-default-log-level` configuration and per-stage `LogLevels.onFailure` attribute from #2805 - Logging placed to avoid double-logging (uses `Holder`'s directive cache to ensure exactly one log per failure) ## Changes - `MapAsync`: Added `StageLogging` mixin, `logSupervisionFailure` helper, logging in `pushNextIfPossible` and sync exception handler - `MapAsyncUnordered`: Added `StageLogging` mixin, `logSupervisionFailure` helper, logging in `futureCompleted` and sync exception handler - `MapAsyncPartitioned`: Added `StageLogging` mixin, `logSupervisionFailure` helper, logging in both ordered and unordered `pushNextIfPossible` and sync exception handler ### Motivation `MapAsync`, `MapAsyncUnordered`, and `MapAsyncPartitioned` silently skip failed elements when the supervision strategy returns Resume or Restart. This makes production debugging difficult — users cannot see which elements were dropped or what exceptions occurred. ### Modification - Mix in `StageLogging` trait for all three operators - Add `logSupervisionFailure` helper that checks `LogLevels.onFailure` attribute, falls back to `LogLevels.defaultErrorLevel(system)`, and logs at the configured level - For `MapAsync` and `MapAsyncPartitioned`, logging is placed in `pushNextIfPossible` (not in `futureCB` or the fast path) to avoid double-logging since the `Holder` caches the supervision directive - For `MapAsyncUnordered`, logging is placed in `futureCompleted` (no buffer re-processing) - Sync exception handlers log directly since they bypass the `Holder` caching ### Result Supervision Resume/Restart decisions now produce log entries with exception details, enabling users to diagnose dropped elements. Log level can be controlled via `pekko.stream.materializer.stage-errors-default-log-level` config or per-stage `ActorAttributes.logLevels`. ### Tests - `FlowMapAsyncSpec`: 3 new tests (async future failure logs, sync throw logs, log level Off disables logging) - `FlowMapAsyncUnorderedSpec`: 3 new tests (same pattern) - `FlowMapAsyncPartitionedSpec`: 3 new tests (ordered, unordered, log level Off) - All 74 existing + new tests pass ### References Fixes #3103 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
