crowdsec icon indicating copy to clipboard operation
crowdsec copied to clipboard

Blackhole new behaviour and add support for WAL when using sqlite

Open blotus opened this issue 3 years ago • 3 comments

  • Allow to enable WAL when using sqlite
  • Change blackhole behaviour: previously, a bucket would have been created even if the overflow would be discarded in the end. This could lead to a lot of useless buckets being created and tracked.

The new behaviour prevents the bucket creation if the scenario is blackholed.

This slightly change the meaning of blackhole: before, a new bucket would be created, events poured to it, if the blackhole expired before it was full enough to overflow, it would be allowed to overflow normally. Now, the bucket will not be created in the first place, which means that some overflows that would have happened with the old behaviour will not happen now (this is likely not an issue in real life).

  • [ ] tests needed

blotus avatar Aug 08 '22 10:08 blotus

Codecov Report

Merging #1708 (56f457d) into master (15a9e16) will increase coverage by 4.41%. The diff coverage is 34.61%.

@@            Coverage Diff             @@
##           master    #1708      +/-   ##
==========================================
+ Coverage   53.45%   57.86%   +4.41%     
==========================================
  Files         136      104      -32     
  Lines       18980    12600    -6380     
==========================================
- Hits        10145     7291    -2854     
+ Misses       7715     4570    -3145     
+ Partials     1120      739     -381     
Flag Coverage Δ
func-crowdsec ?
func-cscli ?
unit-linux 63.91% <34.61%> (-0.21%) :arrow_down:
unit-windows 53.26% <34.61%> (-0.27%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/apiserver/controllers/v1/alerts.go 72.54% <ø> (-0.14%) :arrow_down:
pkg/csconfig/database.go 100.00% <ø> (ø)
pkg/leakybucket/bucket.go 84.34% <ø> (-0.08%) :arrow_down:
pkg/leakybucket/blackhole.go 37.25% <14.28%> (-62.75%) :arrow_down:
pkg/leakybucket/manager_run.go 68.91% <76.47%> (+1.89%) :arrow_up:
pkg/apiclient/signal.go 50.00% <0.00%> (ø)
pkg/apiclient/metrics.go 76.92% <0.00%> (ø)
pkg/apiclient/auth_service.go 68.08% <0.00%> (ø)
pkg/apiclient/alerts_service.go 68.18% <0.00%> (ø)
... and 34 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Aug 08 '22 11:08 codecov-commenter

We (lichess.org) are running this in production right now. I'll report if anything unexpected happens.

ornicar avatar Aug 10 '22 20:08 ornicar

Test needed to be merged.

sabban avatar Aug 26 '22 11:08 sabban