Functional renormalization group for signal detection and stochastic ergodicity breaking