coverband 4.2.4.rc.2 → 4.2.4.rc.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b7fc3e6e0997909a0db557caf78e6ed4ddbf61441b80b44a35eebd195036fb3
4
- data.tar.gz: 1adc60c3e2b7a805fd2c0f2863a1a7ec820593b0a918788fbf1ff18b7cfb9d52
3
+ metadata.gz: 13e53266c2fa52796b86da93197611c290f7a0c40e304ef5b75d24c45eed9db3
4
+ data.tar.gz: 95b685919c1edd7156f1f940d30f05381a1ac6684863557843001f8edf923125
5
5
  SHA512:
6
- metadata.gz: 15db51c202c98481732a6092703fab2b83ef929dfbcd1fee0620f9275ec1be208e5f399b06ec29b2162ff2ca399dfa3db37b0e8e0e87c0abe2dd76eaa09fbaa7
7
- data.tar.gz: b55cf6a2ef95973910ba21ec4bd6f6fd9172f70c0e77b10dcf62780ac37abbfeaec1d44611ebd9e4f2d1a3ef85a20b5b2869054c385bbd7cee5ce9bf775b1ce5
6
+ metadata.gz: 2e12f0556877efd6435887c447ef3278ab89c0c3ca6740b7ba0de33f9757e17038eb29a74297e9fb29707a8c4d9c999b1138117d3bb64607e0f4da82ca64e0c4
7
+ data.tar.gz: 27cfd67015140d2461fb2a9217d06c9782823433c8cbdad3be67e6cc05ea26125dab778656ff0b2023e5e806a277dd1c9028976ddd5dedcc8b90e3505d94598f
data/README.md CHANGED
@@ -205,6 +205,7 @@ config.ignore += ['config/application.rb',
205
205
  'config/environments/*',
206
206
  'lib/tasks/*']
207
207
  ```
208
+
208
209
  ### View Tracking
209
210
 
210
211
  Coverband allows an optional feature to track all view files that are used by an application.
@@ -236,6 +237,14 @@ ENV['AWS_ACCESS_KEY_ID']
236
237
  ENV['AWS_SECRET_ACCESS_KEY']
237
238
  ```
238
239
 
240
+ ### Avoiding Cache Stampede
241
+
242
+ If you have many servers and they all hit Redis at the same time you can see spikes in your Redis CPU, and memory. This is do to a concept called [cache stampede](https://en.wikipedia.org/wiki/Cache_stampede). It is better to spread out the reporting across your servers. A simple way to do this is to add a random wiggle on your background reporting. This configuration option allows a wiggle. The right amount of wiggle depends on the numbers of servers you have and how willing you are to have delays in your coverage reporting. I would recommend at least 1 second per server.
243
+
244
+ Add a wiggle (in seconds) to the background thread to avoid all your servers reporting at the same time:
245
+
246
+ `config.reporting_wiggle = 30`
247
+
239
248
  ### Redis Hash Store
240
249
 
241
250
  Coverband on very high volume sites with many server processes reporting can have a race condition. To resolve the race condition and reduce Ruby memory overhead we have introduced a new Redis storage option. This moves the some of the work from the Ruby processes to Redis. It is worth noting because of this, it has a larger demands on the Redis server. So adjust your Redis instance accordingly. To help reduce the extra redis load you can also change the background reporting time period.
@@ -342,6 +351,12 @@ If you are trying to debug locally wondering what code is being run during a req
342
351
  - Coverband 3.0.X+ requires Ruby 2.3+
343
352
  - Coverband currently requires Redis for production usage
344
353
 
354
+ ### Ruby and Rails Version Support
355
+
356
+ We will match Heroku & Ruby's support lifetime, supporting the last 3 major Ruby releases. For details see [supported runtimes](https://devcenter.heroku.com/articles/ruby-support#supported-runtimes).
357
+
358
+ For Rails, we will follow the policy of the [Rails team maintenance policy](https://guides.rubyonrails.org/maintenance_policy.html). We officially support the last two major release versions, while providing minimal support (major bugs / security fixes) for an additional version. This means at the moment we primaryly target Rails 6.x, 5.x, and will try to keep current functionality working for Rails 4.x but may release new features that do not work on that target.
359
+
345
360
  # Contributing To Coverband
346
361
 
347
362
  If you are working on adding features, PRs, or bugfixes to Coverband this section should help get you going.
data/changes.md CHANGED
@@ -86,6 +86,7 @@ Feature Ideas:
86
86
  - debug data now includes md5_hashes
87
87
  - added support to download coverage and view data in JSON format
88
88
  - documentation about working with environment variables
89
+ - add cache wiggle to avoid Redis CPU spikes (cache stampede on Redis server)
89
90
 
90
91
  # Released
91
92
 
@@ -8,9 +8,11 @@ module Coverband
8
8
  :background_reporting_enabled,
9
9
  :background_reporting_sleep_seconds, :test_env,
10
10
  :web_enable_clear, :gem_details, :web_debug, :report_on_exit,
11
- :simulate_oneshot_lines_coverage, :track_views, :view_tracker
11
+ :simulate_oneshot_lines_coverage, :track_views, :view_tracker,
12
+ :reporting_wiggle
12
13
 
13
- attr_writer :logger, :s3_region, :s3_bucket, :s3_access_key_id, :s3_secret_access_key, :password
14
+ attr_writer :logger, :s3_region, :s3_bucket, :s3_access_key_id,
15
+ :s3_secret_access_key, :password
14
16
  attr_reader :track_gems, :ignore, :use_oneshot_lines_coverage
15
17
 
16
18
  #####
@@ -82,6 +84,7 @@ module Coverband
82
84
  @s3_secret_access_key = nil
83
85
  @redis_namespace = nil
84
86
  @redis_ttl = 2_592_000 # in seconds. Default is 30 days.
87
+ @reporting_wiggle = nil
85
88
  end
86
89
 
87
90
  def logger
@@ -33,6 +33,9 @@ module Coverband
33
33
  loop do
34
34
  Coverband.report_coverage
35
35
  Coverband.configuration.view_tracker&.report_views_tracked
36
+ if Coverband.configuration.reporting_wiggle
37
+ sleep_seconds = Coverband.configuration.background_reporting_sleep_seconds + rand(Coverband.configuration.reporting_wiggle.to_i)
38
+ end
36
39
  if Coverband.configuration.verbose
37
40
  logger.debug("Coverband: background reporting coverage (#{Coverband.configuration.store.type}). Sleeping #{sleep_seconds}s")
38
41
  end
@@ -5,5 +5,5 @@
5
5
  # use format '4.2.1.rc.1' ~> 4.2.1.rc to prerelease versions like v4.2.1.rc.2 and v4.2.1.rc.3
6
6
  ###
7
7
  module Coverband
8
- VERSION = '4.2.4.rc.2'
8
+ VERSION = '4.2.4.rc.3'
9
9
  end
@@ -19,6 +19,16 @@ class BackgroundTest < Minitest::Test
19
19
  2.times { Coverband::Background.start }
20
20
  end
21
21
 
22
+ def test_start_with_wiggle
23
+ Thread.expects(:new).yields.returns(ThreadDouble.new(true))
24
+ Coverband::Background.expects(:loop).yields
25
+ Coverband::Background.expects(:sleep).with(35)
26
+ Coverband::Background.expects(:rand).with(10).returns(5)
27
+ Coverband.configuration.reporting_wiggle = 10
28
+ Coverband::Collectors::Coverage.instance.expects(:report_coverage).once
29
+ 2.times { Coverband::Background.start }
30
+ end
31
+
22
32
  def test_start_dead_thread
23
33
  Thread.expects(:new).yields.returns(ThreadDouble.new(false)).twice
24
34
  Coverband::Background.expects(:loop).yields.twice
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.4.rc.2
4
+ version: 4.2.4.rc.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-24 00:00:00.000000000 Z
12
+ date: 2019-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-s3