appsignal 3.9.2-java → 3.10.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +3138 -0
  3. data/.rubocop.yml +28 -20
  4. data/.rubocop_todo.yml +7 -33
  5. data/CHANGELOG.md +130 -0
  6. data/README.md +0 -1
  7. data/Rakefile +80 -65
  8. data/appsignal.gemspec +1 -1
  9. data/build_matrix.yml +112 -184
  10. data/ext/base.rb +1 -1
  11. data/gemfiles/hanami-2.1.gemfile +7 -0
  12. data/gemfiles/webmachine1.gemfile +5 -4
  13. data/lib/appsignal/cli/diagnose.rb +1 -1
  14. data/lib/appsignal/config.rb +5 -1
  15. data/lib/appsignal/demo.rb +0 -1
  16. data/lib/appsignal/environment.rb +11 -2
  17. data/lib/appsignal/extension/jruby.rb +1 -1
  18. data/lib/appsignal/helpers/instrumentation.rb +164 -2
  19. data/lib/appsignal/hooks/active_job.rb +1 -6
  20. data/lib/appsignal/integrations/grape.rb +19 -47
  21. data/lib/appsignal/integrations/hanami.rb +8 -7
  22. data/lib/appsignal/integrations/padrino.rb +51 -52
  23. data/lib/appsignal/integrations/railtie.rb +0 -3
  24. data/lib/appsignal/integrations/rake.rb +46 -12
  25. data/lib/appsignal/integrations/sidekiq.rb +1 -11
  26. data/lib/appsignal/integrations/sinatra.rb +0 -1
  27. data/lib/appsignal/integrations/webmachine.rb +15 -9
  28. data/lib/appsignal/probes/gvl.rb +24 -2
  29. data/lib/appsignal/probes/sidekiq.rb +1 -1
  30. data/lib/appsignal/probes.rb +1 -1
  31. data/lib/appsignal/rack/abstract_middleware.rb +104 -33
  32. data/lib/appsignal/rack/body_wrapper.rb +143 -0
  33. data/lib/appsignal/rack/event_handler.rb +12 -3
  34. data/lib/appsignal/rack/generic_instrumentation.rb +5 -4
  35. data/lib/appsignal/rack/grape_middleware.rb +40 -0
  36. data/lib/appsignal/rack/hanami_middleware.rb +2 -12
  37. data/lib/appsignal/rack/instrumentation_middleware.rb +62 -0
  38. data/lib/appsignal/rack/rails_instrumentation.rb +14 -57
  39. data/lib/appsignal/rack/sinatra_instrumentation.rb +1 -3
  40. data/lib/appsignal/rack/streaming_listener.rb +13 -59
  41. data/lib/appsignal/rack.rb +31 -0
  42. data/lib/appsignal/transaction.rb +50 -8
  43. data/lib/appsignal/utils/integration_memory_logger.rb +78 -0
  44. data/lib/appsignal/utils.rb +1 -0
  45. data/lib/appsignal/version.rb +1 -1
  46. data/lib/appsignal.rb +36 -33
  47. data/spec/.rubocop.yml +1 -1
  48. data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
  49. data/spec/lib/appsignal/cli/install_spec.rb +3 -3
  50. data/spec/lib/appsignal/config_spec.rb +8 -5
  51. data/spec/lib/appsignal/demo_spec.rb +38 -41
  52. data/spec/lib/appsignal/hooks/action_cable_spec.rb +86 -167
  53. data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +8 -20
  54. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +38 -84
  55. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +16 -37
  56. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +4 -4
  57. data/spec/lib/appsignal/hooks/activejob_spec.rb +111 -200
  58. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +54 -91
  59. data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +14 -32
  60. data/spec/lib/appsignal/hooks/excon_spec.rb +8 -12
  61. data/spec/lib/appsignal/hooks/net_http_spec.rb +7 -42
  62. data/spec/lib/appsignal/hooks/rake_spec.rb +107 -34
  63. data/spec/lib/appsignal/hooks/redis_client_spec.rb +18 -30
  64. data/spec/lib/appsignal/hooks/redis_spec.rb +10 -16
  65. data/spec/lib/appsignal/hooks/resque_spec.rb +42 -62
  66. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +33 -74
  67. data/spec/lib/appsignal/integrations/hanami_spec.rb +79 -21
  68. data/spec/lib/appsignal/integrations/http_spec.rb +12 -20
  69. data/spec/lib/appsignal/integrations/net_http_spec.rb +33 -0
  70. data/spec/lib/appsignal/integrations/object_spec.rb +29 -36
  71. data/spec/lib/appsignal/integrations/padrino_spec.rb +190 -163
  72. data/spec/lib/appsignal/integrations/que_spec.rb +43 -70
  73. data/spec/lib/appsignal/integrations/railtie_spec.rb +26 -67
  74. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +86 -160
  75. data/spec/lib/appsignal/integrations/sinatra_spec.rb +10 -3
  76. data/spec/lib/appsignal/integrations/webmachine_spec.rb +77 -40
  77. data/spec/lib/appsignal/probes/gvl_spec.rb +80 -3
  78. data/spec/lib/appsignal/probes_spec.rb +7 -4
  79. data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +302 -105
  80. data/spec/lib/appsignal/rack/body_wrapper_spec.rb +263 -0
  81. data/spec/lib/appsignal/rack/event_handler_spec.rb +81 -78
  82. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +70 -27
  83. data/spec/lib/appsignal/rack/grape_middleware_spec.rb +234 -0
  84. data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +2 -16
  85. data/spec/lib/appsignal/rack/instrumentation_middleware_spec.rb +38 -0
  86. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +67 -131
  87. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +36 -44
  88. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +44 -139
  89. data/spec/lib/appsignal/transaction_spec.rb +239 -94
  90. data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +163 -0
  91. data/spec/lib/appsignal_spec.rb +556 -344
  92. data/spec/support/helpers/dependency_helper.rb +6 -1
  93. data/spec/support/helpers/std_streams_helper.rb +1 -1
  94. data/spec/support/helpers/transaction_helpers.rb +8 -0
  95. data/spec/support/matchers/transaction.rb +185 -0
  96. data/spec/support/mocks/dummy_app.rb +20 -0
  97. data/spec/support/shared_examples/instrument.rb +17 -12
  98. data/spec/support/testing.rb +18 -9
  99. metadata +20 -11
  100. data/.semaphore/semaphore.yml +0 -2347
  101. data/script/lint_git +0 -22
  102. data/spec/lib/appsignal/integrations/grape_spec.rb +0 -239
  103. data/spec/support/matchers/be_completed.rb +0 -5
  104. data/support/check_versions +0 -22
  105. /data/gemfiles/{hanami.gemfile → hanami-2.0.gemfile} +0 -0
data/.rubocop.yml CHANGED
@@ -51,6 +51,20 @@ Style/Lambda:
51
51
  Style/WordArray:
52
52
  Enabled: false
53
53
 
54
+ Style/FrozenStringLiteralComment:
55
+ Enabled: true
56
+ Exclude:
57
+ - "spec/**/*.rb"
58
+
59
+ Style/NumericPredicate:
60
+ Enabled: false
61
+
62
+ Style/SymbolArray:
63
+ EnforcedStyle: brackets
64
+
65
+ Style/RedundantConstantBase:
66
+ Enabled: false
67
+
54
68
  Lint/ConstantDefinitionInBlock:
55
69
  Exclude:
56
70
  - "spec/**/*.rb"
@@ -59,6 +73,10 @@ Lint/EmptyClass:
59
73
  Exclude:
60
74
  - "spec/**/*.rb"
61
75
 
76
+ Lint/EmptyFile:
77
+ Exclude:
78
+ - "spec/**/*.rb"
79
+
62
80
  Layout/HashAlignment:
63
81
  EnforcedLastArgumentHashStyle: ignore_implicit
64
82
 
@@ -83,20 +101,27 @@ Layout/MultilineMethodCallIndentation:
83
101
  Layout/MultilineOperationIndentation:
84
102
  EnforcedStyle: indented
85
103
 
86
- Lint/EmptyFile:
87
- Exclude:
88
- - "spec/**/*.rb"
104
+ Layout/LineLength:
105
+ Max: 100
89
106
 
90
107
  Naming/FileName:
91
108
  Exclude:
92
109
  - "ext/Rakefile"
93
110
 
111
+ Naming/AccessorMethodName:
112
+ Exclude:
113
+ - "lib/appsignal/helpers/instrumentation.rb"
114
+ - "lib/appsignal/transaction.rb"
115
+
94
116
  Naming/RescuedExceptionsVariableName:
95
117
  Enabled: false
96
118
 
97
119
  Naming/VariableNumber:
98
120
  Enabled: false
99
121
 
122
+ Metrics/ModuleLength:
123
+ Enabled: false
124
+
100
125
  Metrics/ClassLength:
101
126
  Enabled: false
102
127
 
@@ -104,22 +129,5 @@ Metrics/BlockLength:
104
129
  Exclude:
105
130
  - "Rakefile"
106
131
 
107
- Style/FrozenStringLiteralComment:
108
- Enabled: true
109
- Exclude:
110
- - "spec/**/*.rb"
111
-
112
- Style/NumericPredicate:
113
- Enabled: false
114
-
115
- Style/SymbolArray:
116
- EnforcedStyle: brackets
117
-
118
- Style/RedundantConstantBase:
119
- Enabled: false
120
-
121
132
  Gemspec/DevelopmentDependencies:
122
133
  Enabled: false
123
-
124
- Layout/LineLength:
125
- Max: 100
data/.rubocop_todo.yml CHANGED
@@ -1,66 +1,49 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-04-12 14:23:03 UTC using RuboCop version 1.50.0.
3
+ # on 2024-06-27 09:42:06 UTC using RuboCop version 1.64.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 3
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
12
- # URISchemes: http, https
13
- Layout/LineLength:
14
- Max: 112
15
-
16
9
  # Offense count: 2
10
+ # Configuration parameters: AllowedParentClasses.
17
11
  Lint/MissingSuper:
18
12
  Exclude:
19
13
  - 'lib/appsignal/extension.rb'
20
14
  - 'lib/appsignal/logger.rb'
21
15
 
22
- # Offense count: 1
23
- Lint/NoReturnInBeginEndBlocks:
24
- Exclude:
25
- - 'lib/appsignal/environment.rb'
26
-
27
16
  # Offense count: 1
28
17
  Lint/StructNewOverride:
29
18
  Exclude:
30
19
  - 'spec/lib/appsignal/probes/sidekiq_spec.rb'
31
20
 
32
- # Offense count: 53
21
+ # Offense count: 63
33
22
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
34
23
  Metrics/AbcSize:
35
24
  Max: 44
36
25
 
37
- # Offense count: 5
26
+ # Offense count: 6
38
27
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
39
28
  # AllowedMethods: refine
40
29
  Metrics/BlockLength:
41
30
  Max: 31
42
31
 
43
- # Offense count: 17
32
+ # Offense count: 21
44
33
  # Configuration parameters: AllowedMethods, AllowedPatterns.
45
34
  Metrics/CyclomaticComplexity:
46
35
  Max: 11
47
36
 
48
- # Offense count: 127
37
+ # Offense count: 139
49
38
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
50
39
  Metrics/MethodLength:
51
40
  Max: 56
52
41
 
53
- # Offense count: 12
42
+ # Offense count: 18
54
43
  # Configuration parameters: AllowedMethods, AllowedPatterns.
55
44
  Metrics/PerceivedComplexity:
56
45
  Max: 13
57
46
 
58
- # Offense count: 7
59
- Naming/AccessorMethodName:
60
- Exclude:
61
- - 'lib/appsignal/helpers/instrumentation.rb'
62
- - 'lib/appsignal/transaction.rb'
63
-
64
47
  # Offense count: 2
65
48
  Security/Open:
66
49
  Exclude:
@@ -82,15 +65,6 @@ Style/Alias:
82
65
  - 'lib/appsignal/helpers/instrumentation.rb'
83
66
  - 'lib/appsignal/transaction.rb'
84
67
 
85
- # Offense count: 2
86
- # This cop supports unsafe autocorrection (--autocorrect-all).
87
- # Configuration parameters: EnforcedStyle.
88
- # SupportedStyles: nested, compact
89
- Style/ClassAndModuleChildren:
90
- Exclude:
91
- - 'lib/appsignal/integrations/hanami.rb'
92
- - 'lib/appsignal/integrations/padrino.rb'
93
-
94
68
  # Offense count: 1
95
69
  Style/ClassVars:
96
70
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,135 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.10.0
4
+
5
+ _Published on 2024-07-08._
6
+
7
+ ### Added
8
+
9
+ - Add our new recommended Rack instrumentation middleware. If an app is using the `Appsignal::Rack::GenericInstrumentation` middleware, please update it to use `Appsignal::Rack::InstrumentationMiddleware` instead.
10
+
11
+ This new middleware will not report all requests under the "unknown" action if no action name is set. To set an action name, call the `Appsignal.set_action` helper from the app.
12
+
13
+ ```ruby
14
+ # config.ru
15
+
16
+ # Setup AppSignal
17
+
18
+ use Appsignal::Rack::InstrumentationMiddleware
19
+
20
+ # Run app
21
+ ```
22
+
23
+ (minor [f2596781](https://github.com/appsignal/appsignal-ruby/commit/f259678111067bd3d7cf60552201f4d4f95a99d6))
24
+ - Add Rake task performance instrumentation. Configure the `enable_rake_performance_instrumentation` option to `true` to enable Rake task instrumentation for both error and performance monitoring. To ignore specific Rake tasks, configure `ignore_actions` to include the name of the Rake task. (minor [63c9aeed](https://github.com/appsignal/appsignal-ruby/commit/63c9aeed978fcd0942238772c2e441b33e12e16a))
25
+ - Add instrumentation to Rack responses, including streaming responses. New `process_response_body.rack` and `close_response_body.rack` events will be shown in the event timeline. These events show how long it takes to complete responses, depending on the response implementation, and when the response is closed.
26
+
27
+ This Sinatra route with a streaming response will be better instrumented, for example:
28
+
29
+ ```ruby
30
+ get "/stream" do
31
+ stream do |out|
32
+ sleep 1
33
+ out << "1"
34
+ sleep 1
35
+ out << "2"
36
+ sleep 1
37
+ out << "3"
38
+ end
39
+ end
40
+ ```
41
+
42
+ (minor [bd2f037b](https://github.com/appsignal/appsignal-ruby/commit/bd2f037ba4840f4606373ee2fc11553f098d5436))
43
+ - Add the `Appsignal.report_error` helper to report errors. If you unsure whether to use the `Appsignal.set_error` or `Appsignal.send_error` helpers in what context, use `Appsignal.report_error` to always report the error. (minor [1502ea14](https://github.com/appsignal/appsignal-ruby/commit/1502ea147210d77dd4ee9d301c52ace30c2a6700))
44
+ - Support nested webmachine apps. If webmachine apps are nested in other AppSignal instrumentation it will now report the webmachine instrumentation as part of the parent transaction, reporting more runtime of the request. (patch [243d20ac](https://github.com/appsignal/appsignal-ruby/commit/243d20acd68a9e59a01d74e17abb910691667b25))
45
+ - Report the response status for Padrino requests as the `response_status` tag on samples, e.g. 200, 301, 500. This tag is visible on the sample detail page.
46
+ Report the response status for Padrino requests as the `response_status` metric.
47
+
48
+ (patch [9239c26b](https://github.com/appsignal/appsignal-ruby/commit/9239c26beb144b9d8bf094bc58030cd618633c38))
49
+ - Add support for nested Padrino apps. When a Padrino app is nested in another Padrino app, or another framework like Sinatra or Rails, it will now report the entire request. (patch [9239c26b](https://github.com/appsignal/appsignal-ruby/commit/9239c26beb144b9d8bf094bc58030cd618633c38))
50
+ - Add `Appsignal.set_params` helper. Set custom parameters on the current transaction with the `Appsignal.set_params` helper. Note that this will overwrite any request parameters that would be set automatically on the transaction. When this method is called multiple times, it will overwrite the previously set value.
51
+
52
+ ```ruby
53
+ Appsignal.set_params("param1" => "value1", "param2" => "value2")
54
+ ```
55
+
56
+ (patch [e8d73e8d](https://github.com/appsignal/appsignal-ruby/commit/e8d73e8d31264c44dd5db5d769be6b599b0ded48))
57
+ - Add `Appsignal.set_custom_data` helper to set custom data on the transaction. Previously, this could only be set with `Appsignal::Transaction.current.set_custom_data("custom_data", ...)`. This helper makes setting the custom data more convenient. (patch [875e4435](https://github.com/appsignal/appsignal-ruby/commit/875e4435ba97838f79a02ff456d3418bc012634a))
58
+ - Add `Appsignal.set_tags` helper as an alias for `Appsignal.tag_request`. This is a context independent named alias available on the Transaction class as well. (patch [1502ea14](https://github.com/appsignal/appsignal-ruby/commit/1502ea147210d77dd4ee9d301c52ace30c2a6700))
59
+ - Add a block argument to the `Appsignal.set_params` and `Appsignal::Transaction#set_params` helpers. When `set_params` is called with a block argument, the block is executed when the parameters are stored on the Transaction. This block is only called when the Transaction is sampled. Use this block argument to avoid having to parse parameters for every transaction, to speed things up when the transaction is not sampled.
60
+
61
+ ```ruby
62
+ Appsignal.set_params do
63
+ # Some slow code to parse parameters
64
+ JSON.parse('{"param1": "value1"}')
65
+ end
66
+ ```
67
+
68
+ (patch [1502ea14](https://github.com/appsignal/appsignal-ruby/commit/1502ea147210d77dd4ee9d301c52ace30c2a6700))
69
+
70
+ ### Deprecated
71
+
72
+ - Deprecate the `appsignal.action` and `appsignal.route` request env methods to set the transaction action name. Use the `Appsignal.set_action` helper instead.
73
+
74
+ ```ruby
75
+ # Before
76
+ env["appsignal.action"] = "POST /my-action"
77
+ env["appsignal.route"] = "POST /my-action"
78
+
79
+ # After
80
+ Appsignal.set_action("POST /my-action")
81
+ ```
82
+
83
+ (patch [1e6d0b31](https://github.com/appsignal/appsignal-ruby/commit/1e6d0b315577176d4dd37db0a8f5fde89c66e8a4))
84
+ - Deprecate the `Appsignal::Rack::StreamingListener` middleware. Use the `Appsignal::Rack::InstrumentationMiddleware` middleware instead. (patch [57d6fa33](https://github.com/appsignal/appsignal-ruby/commit/57d6fa3386d9a9720da76c7b899a332952d472e0))
85
+ - Deprecate the `Appsignal::Rack::GenericInstrumentation` middleware. Use the `Appsignal::Rack::InstrumentationMiddleware` middleware instead. See also the changelog entry about the `InstrumentationMiddleware`. (patch [1502ea14](https://github.com/appsignal/appsignal-ruby/commit/1502ea147210d77dd4ee9d301c52ace30c2a6700))
86
+
87
+ ### Fixed
88
+
89
+ - Fix issue with AppSignal getting stuck in a boot loop when loading the Padrino integration with: `require "appsignal/integrations/padrino"`
90
+ This could happen in nested applications, like a Padrino app in a Rails app. AppSignal will now use the first config AppSignal starts with.
91
+
92
+ (patch [10722b60](https://github.com/appsignal/appsignal-ruby/commit/10722b60d0ad9dc63b2c7add7d5ee8703190b8f0))
93
+ - Fix the deprecation warning of `Bundler.rubygems.all_specs` usage. (patch [1502ea14](https://github.com/appsignal/appsignal-ruby/commit/1502ea147210d77dd4ee9d301c52ace30c2a6700))
94
+
95
+ ## 3.9.3
96
+
97
+ _Published on 2024-07-02._
98
+
99
+ ### Added
100
+
101
+ - [0230ab4d](https://github.com/appsignal/appsignal-ruby/commit/0230ab4da00d75e4fc72fd493fc98441b5d7254d) patch - Track error response status for web requests. When an unhandled exception reaches the AppSignal EventHandler instrumentation, report the response status as `500` for the `response_status` tag on the transaction and on the `response_status` metric.
102
+
103
+ ### Changed
104
+
105
+ - [b3a80038](https://github.com/appsignal/appsignal-ruby/commit/b3a800380c0d83422d7f3c0e9c93551d343c50c0) patch - Require the AppSignal gem in the Grape integration file. Previously `require "appsignal"` had to be called before `require "appsignal/integrations/grape"`. This `require "appsignal"` is no longer required.
106
+ - [e9aa0603](https://github.com/appsignal/appsignal-ruby/commit/e9aa06031b6c17f9f2704250bb1775a4cb72b276) patch - Report Global VM Lock metrics per process. In addition to the existing `hostname` tag, add `process_name` and `process_id` tags to the `gvl_global_timer` and `gvl_waiting_threads` metrics emitted by the [GVL probe](https://docs.appsignal.com/ruby/integrations/global-vm-lock.html), allowing these metrics to be tracked in a per-process basis.
107
+
108
+ ### Deprecated
109
+
110
+ - [844aa0af](https://github.com/appsignal/appsignal-ruby/commit/844aa0afa3311860dca84badc27c2be8996bfd3c) patch - Deprecate `Appsignal::Grape::Middleware` constant in favor of `Appsignal::Rack::GrapeMiddleware` constant.
111
+
112
+ To fix this deprecation warning, update the usage of `Appsignal::Grape::Middleware` like this:
113
+
114
+ ```ruby
115
+ # Grape only apps
116
+ insert_before Grape::Middleware::Error, Appsignal::Rack::GrapeMiddleware
117
+ # or
118
+ use Appsignal::Rack::GrapeMiddleware
119
+
120
+ # Grape on Rails app
121
+ use Appsignal::Rack::GrapeMiddleware
122
+ ```
123
+ - [1f648ab4](https://github.com/appsignal/appsignal-ruby/commit/1f648ab4d0372f37d15a980a9902779834811531) patch - Deprecate the `Appsignal.start_logger` method. Remove this method call from apps if it is present. Calling `Appsignal.start` will now initialize the logger.
124
+
125
+ ### Fixed
126
+
127
+ - [0bb29809](https://github.com/appsignal/appsignal-ruby/commit/0bb29809f1750bdac2b66a1132a3638c58e6d1f8) patch - Fix an issue with invalid request methods raising an error in the GenericInstrumentation middleware when using a request class that throws an error when calling the `request_method` method, like `ActionDispatch::Request`.
128
+ - [66bb7a60](https://github.com/appsignal/appsignal-ruby/commit/66bb7a60cafd3fb1a91d4ed0430d51ee8ac8de46) patch - Support Grape apps that are nested in other apps like Sinatra and Rails, that also include AppSignal middleware for instrumentation.
129
+ - [a7b056bd](https://github.com/appsignal/appsignal-ruby/commit/a7b056bd333912b3b6388d68d6dd3af0b2cb9a75) patch - Support Hanami version 2.1. On older versions of our Ruby gem it would error on an unknown keyword argument "sessions_enabled".
130
+ - [00b7ac6a](https://github.com/appsignal/appsignal-ruby/commit/00b7ac6a9128d47fa9d3a1556f73a14304de8944) patch - Fix issue with AppSignal getting stuck in a boot loop when loading the Hanami integration with: `require "appsignal/integrations/hanami"`
131
+ This could happen in nested applications, like a Hanami app in a Rails app. It will now use the first config AppSignal starts with.
132
+
3
133
  ## 3.9.2
4
134
 
5
135
  _Published on 2024-06-26._
data/README.md CHANGED
@@ -9,7 +9,6 @@ issues.
9
9
  - [Ruby code documentation][ruby-doc]
10
10
  - [Support][contact]
11
11
 
12
- [![Build status](https://appsignal.semaphoreci.com/badges/appsignal-ruby/branches/main.svg)](https://appsignal.semaphoreci.com/projects/appsignal-ruby)
13
12
  [![Gem Version](https://badge.fury.io/rb/appsignal.svg)](http://badge.fury.io/rb/appsignal)
14
13
  [![Code Climate](https://codeclimate.com/github/appsignal/appsignal.png)](https://codeclimate.com/github/appsignal/appsignal)
15
14
 
data/Rakefile CHANGED
@@ -20,99 +20,114 @@ VERSION_MANAGERS = {
20
20
  }
21
21
  }.freeze
22
22
 
23
- def env_map(key, value)
23
+ def build_job(ruby_version, ruby_gem = nil)
24
24
  {
25
- "name" => key,
26
- "value" => value
25
+ "name" => "Ruby #{ruby_version}#{" - #{ruby_gem}" if ruby_gem}",
26
+ "needs" => "validation",
27
+ "runs-on" => "ubuntu-latest",
28
+ "steps" => [
29
+ {
30
+ "name" => "Check out repository",
31
+ "uses" => "actions/checkout@v4"
32
+ },
33
+ {
34
+ "name" => "Install Ruby",
35
+ "uses" => "ruby/setup-ruby@v1",
36
+ "with" => {
37
+ "ruby-version" => ruby_version,
38
+ "bundler-cache" => true
39
+ }
40
+ },
41
+ {
42
+ "name" => "Install gem extension",
43
+ "run" => "./support/bundler_wrapper exec rake extension:install"
44
+ },
45
+ {
46
+ "name" => "Print extension install report",
47
+ "run" => "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report file found'" # rubocop:disable Layout/LineLength
48
+ },
49
+ {
50
+ "name" => "Print Makefile log file",
51
+ "run" => "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
52
+ }
53
+ ]
27
54
  }
28
55
  end
29
56
 
30
- def build_task(matrix, ruby_version, type = nil)
31
- {
32
- "name" => "Ruby #{ruby_version}#{type ? " - #{type}" : nil}",
33
- "dependencies" => ["Validation"],
34
- "task" => {
35
- "prologue" => matrix["prologue"].merge(
36
- "commands" => matrix["prologue"]["commands"] + [
37
- "./support/bundler_wrapper exec rake extension:install",
38
- "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report file found'", # rubocop:disable Metrics/LineLength
39
- "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
40
- ]
41
- ),
42
- "epilogue" => matrix["epilogue"],
43
- "jobs" => []
44
- }
45
- }
57
+ def build_matrix_key(ruby_version, ruby_gem = nil)
58
+ base = "ruby_#{ruby_version}"
59
+ base = "#{base}__#{ruby_gem}" if ruby_gem
60
+ base.downcase.gsub(/\W/, "-")
46
61
  end
47
62
 
48
63
  def gems_with_gemfiles
49
64
  YAML.load_file("build_matrix.yml")["matrix"]["gems"].map { |g| g["gem"] }.freeze
50
65
  end
51
66
 
67
+ GITHUB_ACTION_WORKFLOW_FILE = ".github/workflows/ci.yml"
68
+
52
69
  namespace :build_matrix do
53
- namespace :semaphore do
70
+ namespace :github do
54
71
  task :generate do
55
72
  yaml = YAML.load_file("build_matrix.yml")
56
73
  matrix = yaml["matrix"]
57
- defaults = matrix["defaults"]
58
- semaphore = yaml["semaphore"]
74
+ github = yaml["github"]
59
75
 
60
- builds = []
76
+ builds = {}
61
77
  matrix["ruby"].each do |ruby|
62
78
  ruby_version = ruby["ruby"]
63
- ruby_primary_block = build_task(matrix, ruby_version)
64
- ruby_secondary_block = build_task(matrix, ruby_version, "Gems").tap do |t|
65
- t["dependencies"] = ["Ruby #{ruby_version}"]
66
- end
67
- gemset_for_ruby(ruby, matrix).each do |gem|
68
- next unless included_for_ruby?(matrix, gem, ruby)
69
-
70
- env = matrix["env_vars"] + [
71
- env_map("RUBY_VERSION", ruby_version),
72
- env_map("GEMSET", gem["gem"]),
73
- env_map("BUNDLE_GEMFILE", "gemfiles/#{gem["gem"]}.gemfile")
74
- ]
75
- rubygems = gem["rubygems"] || ruby["rubygems"] || defaults["rubygems"]
76
- env << env_map("_RUBYGEMS_VERSION", rubygems) if rubygems
77
- bundler = gem["bundler"] || ruby["bundler"] || defaults["bundler"]
78
- env << env_map("_BUNDLER_VERSION", bundler) if bundler
79
-
80
- job = {
81
- "name" => "Ruby #{ruby_version} for #{gem["gem"]}",
82
- "env_vars" => env + ruby.fetch("env_vars", []),
83
- "commands" => [
84
- "./support/bundler_wrapper exec rake test"
85
- ]
79
+ gemset_for_ruby(ruby, matrix).each do |ruby_gem|
80
+ next unless included_for_ruby?(matrix, ruby_gem, ruby)
81
+
82
+ is_primary_job = ruby_gem["gem"] == "no_dependencies"
83
+ job =
84
+ if is_primary_job
85
+ build_job(ruby_version)
86
+ else
87
+ build_job(ruby_version, ruby_gem["gem"])
88
+ end
89
+ job["env"] = matrix["env"]
90
+ .merge("BUNDLE_GEMFILE" => "gemfiles/#{ruby_gem["gem"]}.gemfile")
91
+
92
+ test_step = {
93
+ "name" => "Run tests",
94
+ "run" => "./support/bundler_wrapper exec rake test"
86
95
  }
87
- if gem["gem"] == "no_dependencies"
96
+
97
+ if is_primary_job
98
+ job["steps"] << test_step
88
99
  # Only test the failure scenarios once per Ruby version
89
- job["commands"] << "./support/bundler_wrapper exec rake test:failure"
90
- ruby_primary_block["task"]["jobs"] << job
100
+ job["steps"] << {
101
+ "name" => "Run tests without extension",
102
+ "run" => "./support/bundler_wrapper exec rake test:failure"
103
+ }
104
+ builds[build_matrix_key(ruby["ruby"])] = job
91
105
  else
92
- ruby_secondary_block["task"]["jobs"] << job
106
+ job["needs"] = build_matrix_key(ruby["ruby"])
107
+ job["steps"] << test_step
108
+ builds[build_matrix_key(ruby["ruby"], ruby_gem["gem"])] = job
93
109
  end
94
110
  end
95
- builds << ruby_primary_block
96
- builds << ruby_secondary_block if ruby_secondary_block["task"]["jobs"].count.nonzero?
97
111
  end
98
- semaphore["blocks"] += builds
112
+ github["jobs"] = github["jobs"].merge(builds)
99
113
 
114
+ job_count = github["jobs"].count
100
115
  header = "# DO NOT EDIT\n" \
101
- "# This is a generated file by the `rake build_matrix:semaphore:generate` task.\n" \
116
+ "# This is a generated file by the `rake build_matrix:github:generate` task.\n" \
102
117
  "# See `build_matrix.yml` for the build matrix.\n" \
103
- "# Generate this file with `rake build_matrix:semaphore:generate`.\n"
104
- generated_yaml = header + YAML.dump(semaphore)
105
- File.write(".semaphore/semaphore.yml", generated_yaml)
106
- puts "Generated `.semaphore/semaphore.yml`"
107
- puts "Task count: #{builds.length}"
108
- puts "Job count: #{builds.sum { |block| block["task"]["jobs"].count }}"
118
+ "# Generate this file with `rake build_matrix:github:generate`.\n" \
119
+ "# Generated job count: #{job_count}\n"
120
+ generated_yaml = header + YAML.dump(github)
121
+ File.write(GITHUB_ACTION_WORKFLOW_FILE, generated_yaml)
122
+ puts "Generated `#{GITHUB_ACTION_WORKFLOW_FILE}`"
123
+ puts "Job count: #{job_count}"
109
124
  end
110
125
 
111
126
  task :validate => :generate do
112
127
  output = `git status`
113
- if output.include? ".semaphore/semaphore.yml"
114
- puts "The `.semaphore/semaphore.yml` is modified. The changes were not committed."
115
- puts "Please run `rake build_matrix:semaphore:generate` and commit the changes."
128
+ if output.include? GITHUB_ACTION_WORKFLOW_FILE
129
+ puts "The `#{GITHUB_ACTION_WORKFLOW_FILE}` is modified. The changes were not committed."
130
+ puts "Please run `rake build_matrix:github:generate` and commit the changes."
116
131
  exit 1
117
132
  end
118
133
  end
@@ -191,11 +206,11 @@ namespace :build_matrix do
191
206
  if included_rubies.any?
192
207
  # If this gem only runs on these specific Ruby version
193
208
  included_rubies.each { |version| check_if_ruby_version_exists!(matrix, version) }
194
- return true if included_rubies.include?(ruby["ruby"])
209
+ true if included_rubies.include?(ruby["ruby"])
195
210
  else
196
211
  # If this gem is excluded from running on this Ruby version
197
212
  excluded_rubies.each { |version| check_if_ruby_version_exists!(matrix, version) }
198
- return true unless excluded_rubies.include?(ruby["ruby"])
213
+ true unless excluded_rubies.include?(ruby["ruby"])
199
214
  end
200
215
  end
201
216
 
data/appsignal.gemspec CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
40
40
  gem.add_development_dependency "pry"
41
41
  gem.add_development_dependency "rake", ">= 12"
42
42
  gem.add_development_dependency "rspec", "~> 3.8"
43
- gem.add_development_dependency "rubocop", "1.50.0"
43
+ gem.add_development_dependency "rubocop", "1.64.1"
44
44
  gem.add_development_dependency "timecop"
45
45
  gem.add_development_dependency "webmock"
46
46
  gem.add_development_dependency "yard", ">= 0.9.20"