Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sampler: Support thereafter of zero #1033

Merged
merged 1 commit into from Dec 8, 2021
Merged

sampler: Support thereafter of zero #1033

merged 1 commit into from Dec 8, 2021

Commits on Dec 8, 2021

  1. sampler: Support thereafter of zero

    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
    abhinav committed Dec 8, 2021
    Copy the full SHA
    65e213f View commit details
    Browse the repository at this point in the history