Commit 9367581
authored
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 #10321 parent 10b1fe4 commit 9367581
2 files changed
+52
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
136 | 147 | | |
137 | 148 | | |
138 | 149 | | |
139 | | - | |
| 150 | + | |
140 | 151 | | |
141 | 152 | | |
142 | 153 | | |
| |||
200 | 211 | | |
201 | 212 | | |
202 | 213 | | |
203 | | - | |
| 214 | + | |
204 | 215 | | |
205 | 216 | | |
206 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
0 commit comments