Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sampler: Support thereafter of zero (#1033)
The Zap sampling logger accepts three configuration parameters: interval, first, and thereafter. After we see `first` log with the same message in `interval`, the sampler kicks in. Following that, we let through every `thereafter`-th log. So for example, NewSamplerWithOptions(core, time.Second, 100, 50) This will allow 100 logs with the same message in a second, and following that, every 50th message with that message. In #1032, the user wanted the sampler to reject *all* duplicate messages once the limit was reached, but our sampler panics if `thereafter = 0`. This change adds support for setting `thereafter` to 0, dropping all messages in that interval once the limit is reached. It also adds further explanation to the documentation to address the misuse in #1032. Resolves #1032
- Loading branch information