coverband 5.2.3 → 5.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +6 -1
  3. data/Gemfile +2 -10
  4. data/{Gemfile.rails4 → Gemfile.rails7} +2 -1
  5. data/README.md +10 -9
  6. data/changes.md +12 -0
  7. data/coverband.gemspec +3 -3
  8. data/diagram.svg +1 -1
  9. data/lib/coverband/adapters/hash_redis_store.rb +1 -1
  10. data/lib/coverband/adapters/redis_store.rb +0 -2
  11. data/lib/coverband/collectors/coverage.rb +7 -1
  12. data/lib/coverband/collectors/route_tracker.rb +172 -0
  13. data/lib/coverband/configuration.rb +4 -1
  14. data/lib/coverband/integrations/background.rb +1 -0
  15. data/lib/coverband/reporters/web.rb +41 -4
  16. data/lib/coverband/utils/configuration_template.rb +52 -0
  17. data/lib/coverband/utils/html_formatter.rb +8 -0
  18. data/lib/coverband/utils/rails6_ext.rb +58 -0
  19. data/lib/coverband/utils/railtie.rb +20 -0
  20. data/lib/coverband/utils/tasks.rb +8 -0
  21. data/lib/coverband/version.rb +1 -1
  22. data/lib/coverband.rb +1 -0
  23. data/test/benchmarks/benchmark.rake +0 -1
  24. data/test/coverband/adapters/redis_store_test.rb +1 -1
  25. data/test/coverband/collectors/coverage_test.rb +20 -0
  26. data/test/coverband/collectors/route_tracker_test.rb +167 -0
  27. data/test/coverband/collectors/view_tracker_test.rb +1 -1
  28. data/test/coverband/reporters/web_test.rb +1 -1
  29. data/test/forked/rails_full_stack_views_test.rb +5 -0
  30. data/test/forked/rails_route_tracker_stack_test.rb +45 -0
  31. data/test/forked/rails_view_tracker_stack_test.rb +1 -1
  32. data/test/rails5_dummy/config/coverband.rb +1 -2
  33. data/test/rails7_dummy/Rakefile +6 -0
  34. data/test/rails7_dummy/app/controllers/dummy_controller.rb +5 -0
  35. data/test/rails7_dummy/app/controllers/dummy_view_controller.rb +16 -0
  36. data/test/rails7_dummy/app/views/dummy_view/show.html.erb +5 -0
  37. data/test/rails7_dummy/app/views/dummy_view/show_haml.html.haml +4 -0
  38. data/test/rails7_dummy/app/views/dummy_view/show_slim.html.slim +4 -0
  39. data/test/rails7_dummy/config/application.rb +15 -0
  40. data/test/rails7_dummy/config/boot.rb +3 -0
  41. data/test/rails7_dummy/config/coverband.rb +3 -0
  42. data/test/rails7_dummy/config/coverband_missing_redis.rb +3 -0
  43. data/test/rails7_dummy/config/environment.rb +5 -0
  44. data/test/rails7_dummy/config/routes.rb +7 -0
  45. data/test/rails7_dummy/config/secrets.yml +3 -0
  46. data/test/rails7_dummy/config.ru +4 -0
  47. data/test/rails7_dummy/tmp/.keep +0 -0
  48. data/test/test_helper.rb +14 -5
  49. data/views/nav.erb +7 -2
  50. data/views/route_tracker.erb +49 -0
  51. data/views/view_tracker.erb +1 -1
  52. metadata +42 -5
  53. data/Gemfile.rails6 +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 462b2cd367311f51a377ec76be8d73e4df260b6e473430c5eca87b5f834e6e98
4
- data.tar.gz: f62521bd4123a1da8f07988d192e2655767d9357c0929d414d006260f6b32f41
3
+ metadata.gz: 4da0bd8ef3ca24dee9267fb2caf50081b3f00680c185022f204d55074b92402b
4
+ data.tar.gz: 8db008aa36f52d25e0a6f8cf07e057176933e88a7d0307c3dd64a5092453a73b
5
5
  SHA512:
6
- metadata.gz: 48d7f783030a72a077b228d3358ed8cce0d04fd17f3b452efa30f7e6e9ba4b7904eb8c9ed2d2b5c6a54400f41af9e33c9b505c36a350157f9b97626315651233
7
- data.tar.gz: 3c6b884f98122c7f5d383ddff9b31e424c4c69e12e13e868bd6c0ddab1a3913525d7d9bb3d832cd4f5fa8e5501c188da6aae957d3b0059f6a4e5cf7a683f3b68
6
+ metadata.gz: 15675d5cae8e7cc77df685c3696819ccee5d2fc343ca2b1ab15bc0a55cb4ed522fdb9077d457d4743b46a45475204a08e3cc925871d3ec152d267f062e53617a
7
+ data.tar.gz: 5fcb9ac58c7548c649f28043eb932c0dea9f1250f5f2fdfa8f822c603a6798187b68642b01e4cb7b3cc98e69eb4748a0ff59b148d22ae566855d3646dda27b97
@@ -1,5 +1,6 @@
1
1
  name: CI
2
2
  # Controls when the action will run.
3
+ # Github Actions multiple gemfile support?
3
4
  on:
4
5
  # Triggers the workflow on push or pull request events but only for the master branch
5
6
  push:
@@ -17,7 +18,10 @@ jobs:
17
18
  # remove until I sort out CI issues for truffle
18
19
  # truffleruby,
19
20
  # truffleruby-head,
20
- ruby: [2.3, 2.4, 2.5, 2.6, 2.7, "3.0", jruby, jruby-head]
21
+ # removing jruby again to flaky
22
+ # ruby: [2.3, 2.4, 2.5, 2.6, 2.7, "3.0", "3.1", jruby]
23
+ # need to add support for multiple gemfiles
24
+ ruby: ["2.7", "3.0", "3.1"]
21
25
  redis-version: [4, 5, 6]
22
26
  runs-on: ${{ matrix.os }}-latest
23
27
  steps:
@@ -27,4 +31,5 @@ jobs:
27
31
  with:
28
32
  ruby-version: ${{ matrix.ruby }}
29
33
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - run: bundle exec standardrb
30
35
  - run: bundle exec rake
data/Gemfile CHANGED
@@ -4,15 +4,7 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in coverband.gemspec
6
6
  gemspec
7
-
8
- # add when debugging
9
- # require 'byebug'; byebug
10
- unless ENV["CI"]
11
- gem "pry-byebug"
12
- end
13
-
14
- gem "rails", "~>5"
7
+ gem "rails", "~>6"
15
8
  gem "haml"
16
9
  gem "slim"
17
- # these gems are used for testing gem tracking
18
- gem "irb", require: false
10
+ gem "webrick"
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in coverband.gemspec
6
6
  gemspec
7
- gem 'rails', '~>4'
7
+ gem 'rails', '~>7'
8
8
  gem "haml"
9
9
  gem "slim"
10
+ gem "webrick"
data/README.md CHANGED
@@ -29,12 +29,10 @@ The primary goal of Coverband is giving deep insight into your production runtim
29
29
  - Low performance overhead
30
30
  - Simple setup and configuration
31
31
  - Out of the box support for all standard code execution paths (web, cron, background jobs, rake tasks, etc)
32
- - Splits load time (Rails eager load) and runtime metrics
32
+ - Splits code loading usage (Rails eager load) and runtime usage metrics
33
33
  - Easy to understand actionable insights from the report
34
- - Development mode, offers deep insight of code usage details (number of LOC execution during single request, etc) during development.
35
34
  - Mountable web interface to easily share reports
36
35
 
37
-
38
36
  # Installation
39
37
 
40
38
  ## Redis
@@ -45,7 +43,7 @@ Coverband stores coverage data in Redis. The Redis endpoint is looked for in thi
45
43
  2. `ENV['REDIS_URL']`
46
44
  3. `localhost:6379`
47
45
 
48
- The redis store can also be explicitly defined within the coverband.rb. See [advanced config](#advanced-config).
46
+ The redis store can also be explicitly defined within the `config/coverband.rb`. See [advanced config](#advanced-config).
49
47
 
50
48
  ## Gem Installation
51
49
 
@@ -162,12 +160,12 @@ Take Coverband for a spin on the live Heroku deployed [Coverband Demo](https://c
162
160
  If you need to configure coverband, this can be done by creating a `config/coverband.rb` file relative to your project root.
163
161
 
164
162
  - See [lib/coverband/configuration.rb](https://github.com/danmayer/coverband/blob/master/lib/coverband/configuration.rb) for all options
165
- - By default Coverband will try to stored data to Redis \* Redis endpoint is looked for in this order: `ENV['COVERBAND_REDIS_URL']`, `ENV['REDIS_URL']`, or `localhost`
163
+ - By default Coverband will try to store data to Redis \* Redis endpoint is looked for in this order: `ENV['COVERBAND_REDIS_URL']`, `ENV['REDIS_URL']`, or `localhost`
166
164
 
167
165
  Below is an example config file for a Rails 5 app:
168
166
 
169
167
  ```ruby
170
- #config/coverband.rb
168
+ # config/coverband.rb NOT in the initializers
171
169
  Coverband.configure do |config|
172
170
  config.store = Coverband::Adapters::RedisStore.new(Redis.new(url: ENV['MY_REDIS_URL']))
173
171
  config.logger = Rails.logger
@@ -239,7 +237,7 @@ config.after_initialize do
239
237
  end
240
238
  ```
241
239
 
242
- or if you know you are manually calling eager load anywhere in your initialization process immediately adfter call those two lines. A user reported an issue after calling `ResqueWeb::Engine.eager_load!` for example.
240
+ or if you know you are manually calling eager load anywhere in your initialization process immediately after call those two lines. A user reported an issue after calling `ResqueWeb::Engine.eager_load!` for example.
243
241
 
244
242
  ```ruby
245
243
  Rails.application.routes.draw do
@@ -341,7 +339,7 @@ This conflict happens when a ruby method is patched twice, once using module pre
341
339
 
342
340
  ### Redis Sizing Info
343
341
 
344
- A few folks have asked about what size of Redis is. needed to run coverband. I have some of our largest services with hundreds of servers on cache.m3.medium with plenty of room to spare. I run most apps on the smallest AWS Redis instances available and bump up only if needed or if I am forced to be on a shared Redis instance, which I try to avoid. On Heroku, I have used it with most of the 3rd party and also been fine on the smallest Redis instances, if you have hundreds of dynos you would likely need to scale up. Also note there is a tradeoff one can make, `Coverband::Adapters::HashRedisStore` will use LUA on Redis and increase the Redis load, while being nicer to your app servers and avoid potential lost data during race conditions. While the `Coverband::Adapters::RedisStore` uses in app memory and merging and has lower load on Redis.
342
+ A few folks have asked about what size of Redis is needed to run coverband. I have some of our largest services with hundreds of servers on cache.m3.medium with plenty of room to spare. I run most apps on the smallest AWS Redis instances available and bump up only if needed or if I am forced to be on a shared Redis instance, which I try to avoid. On Heroku, I have used it with most of the 3rd party and also been fine on the smallest Redis instances, if you have hundreds of dynos you would likely need to scale up. Also note there is a tradeoff one can make, `Coverband::Adapters::HashRedisStore` will use LUA on Redis and increase the Redis load, while being nicer to your app servers and avoid potential lost data during race conditions. While the `Coverband::Adapters::RedisStore` uses in app memory and merging and has lower load on Redis.
345
343
 
346
344
  # Newer Features
347
345
 
@@ -376,7 +374,7 @@ Outputs:
376
374
 
377
375
  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).
378
376
 
379
- 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.
377
+ 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 primarily 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.
380
378
 
381
379
  ### JRuby Support
382
380
 
@@ -420,6 +418,9 @@ If you submit a change please make sure the tests and benchmarks are passing.
420
418
  - **Coverage does NOT work when used alongside Scout APM Auto Instrumentation**
421
419
  - In an environment that uses Scout's `AUTO_INSTRUMENT=true` (usually production or staging) it stops reporting any coverage, it will show one or two files that have been loaded at the start but everything else will show up as having 0% coverage
422
420
  - Bug tracked here: https://github.com/scoutapp/scout_apm_ruby/issues/343
421
+ - **Coverband, [Elastic APM](https://github.com/elastic/apm-agent-ruby) and resque**
422
+ - In an environment that uses the Elastic APM ruby agent, resque jobs will fail with `Transactions may not be nested. Already inside #<ElasticAPM::Transaction>` if the `elastic-apm` gem is loaded _before_ the `coverband` gem
423
+ - Put `coverage` ahead of `elastic-apm` in your Gemfile
423
424
 
424
425
  ### Debugging Redis Store
425
426
 
data/changes.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### Coverband 5.2.5
2
+
3
+ - (colemanja91/danmayer) experimental support for route tracking, opt-in
4
+ - remove deprecations for old coverband, rails, and ruby versions out of support
5
+ - Note: official support is now:
6
+ - Ruby: 2.7.6, 3.0.4, 3.1.2 (min versions)
7
+ - Rails: 6.0.x, 6.1.x, 7.0.x, 7.1.x
8
+
9
+ ### Coverband 5.2.4
10
+
11
+ - add install task with example configuration file
12
+
1
13
  ### Coverband 5.2.3
2
14
 
3
15
  - fix for thread error bubbling up
data/coverband.gemspec CHANGED
@@ -20,15 +20,15 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
  spec.require_paths = %w[lib]
23
-
24
- spec.required_ruby_version = '>= 2.3'
23
+
24
+ spec.required_ruby_version = ">= 2.3"
25
25
 
26
26
  spec.metadata = {
27
27
  "homepage_uri" => "https://github.com/danmayer/coverband",
28
28
  "bug_tracker_uri" => "https://github.com/danmayer/coverband/issues",
29
29
  "documentation_uri" => "https://github.com/danmayer/coverband",
30
30
  "changelog_uri" => "https://github.com/danmayer/coverband/blob/main/changes.md",
31
- "source_code_uri" => "https://github.com/danmayer/coverband",
31
+ "source_code_uri" => "https://github.com/danmayer/coverband"
32
32
  }
33
33
 
34
34
  spec.add_development_dependency "benchmark-ips"