appsignal 3.9.3 → 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +22 -19
  3. data/.rubocop.yml +1 -1
  4. data/CHANGELOG.md +180 -0
  5. data/Gemfile +1 -0
  6. data/README.md +0 -1
  7. data/Rakefile +1 -1
  8. data/benchmark.rake +99 -42
  9. data/build_matrix.yml +10 -12
  10. data/gemfiles/webmachine1.gemfile +5 -4
  11. data/lib/appsignal/cli/demo.rb +0 -1
  12. data/lib/appsignal/config.rb +57 -97
  13. data/lib/appsignal/demo.rb +15 -20
  14. data/lib/appsignal/environment.rb +6 -1
  15. data/lib/appsignal/event_formatter/rom/sql_formatter.rb +1 -0
  16. data/lib/appsignal/event_formatter.rb +3 -2
  17. data/lib/appsignal/helpers/instrumentation.rb +490 -16
  18. data/lib/appsignal/hooks/action_cable.rb +21 -16
  19. data/lib/appsignal/hooks/active_job.rb +15 -14
  20. data/lib/appsignal/hooks/delayed_job.rb +1 -1
  21. data/lib/appsignal/hooks/shoryuken.rb +3 -63
  22. data/lib/appsignal/integrations/action_cable.rb +5 -7
  23. data/lib/appsignal/integrations/active_support_notifications.rb +1 -0
  24. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +36 -35
  25. data/lib/appsignal/integrations/data_mapper.rb +1 -0
  26. data/lib/appsignal/integrations/delayed_job_plugin.rb +27 -33
  27. data/lib/appsignal/integrations/dry_monitor.rb +1 -0
  28. data/lib/appsignal/integrations/excon.rb +1 -0
  29. data/lib/appsignal/integrations/http.rb +1 -0
  30. data/lib/appsignal/integrations/net_http.rb +1 -0
  31. data/lib/appsignal/integrations/object.rb +6 -0
  32. data/lib/appsignal/integrations/padrino.rb +21 -25
  33. data/lib/appsignal/integrations/que.rb +13 -20
  34. data/lib/appsignal/integrations/railtie.rb +1 -1
  35. data/lib/appsignal/integrations/rake.rb +45 -15
  36. data/lib/appsignal/integrations/redis.rb +1 -0
  37. data/lib/appsignal/integrations/redis_client.rb +1 -0
  38. data/lib/appsignal/integrations/resque.rb +2 -5
  39. data/lib/appsignal/integrations/shoryuken.rb +75 -0
  40. data/lib/appsignal/integrations/sidekiq.rb +7 -25
  41. data/lib/appsignal/integrations/unicorn.rb +1 -0
  42. data/lib/appsignal/integrations/webmachine.rb +12 -9
  43. data/lib/appsignal/logger.rb +7 -3
  44. data/lib/appsignal/probes/helpers.rb +1 -0
  45. data/lib/appsignal/probes/mri.rb +1 -0
  46. data/lib/appsignal/probes/sidekiq.rb +1 -0
  47. data/lib/appsignal/probes.rb +3 -0
  48. data/lib/appsignal/rack/abstract_middleware.rb +67 -24
  49. data/lib/appsignal/rack/body_wrapper.rb +143 -0
  50. data/lib/appsignal/rack/event_handler.rb +39 -8
  51. data/lib/appsignal/rack/generic_instrumentation.rb +6 -4
  52. data/lib/appsignal/rack/grape_middleware.rb +3 -2
  53. data/lib/appsignal/rack/hanami_middleware.rb +1 -1
  54. data/lib/appsignal/rack/instrumentation_middleware.rb +62 -0
  55. data/lib/appsignal/rack/rails_instrumentation.rb +1 -3
  56. data/lib/appsignal/rack/sinatra_instrumentation.rb +1 -3
  57. data/lib/appsignal/rack/streaming_listener.rb +14 -59
  58. data/lib/appsignal/rack.rb +60 -0
  59. data/lib/appsignal/span.rb +1 -0
  60. data/lib/appsignal/transaction.rb +353 -104
  61. data/lib/appsignal/utils/data.rb +0 -1
  62. data/lib/appsignal/utils/hash_sanitizer.rb +0 -1
  63. data/lib/appsignal/utils/integration_logger.rb +0 -13
  64. data/lib/appsignal/utils/integration_memory_logger.rb +0 -13
  65. data/lib/appsignal/utils/json.rb +0 -1
  66. data/lib/appsignal/utils/query_params_sanitizer.rb +0 -1
  67. data/lib/appsignal/utils/stdout_and_logger_message.rb +0 -1
  68. data/lib/appsignal/utils.rb +6 -0
  69. data/lib/appsignal/version.rb +1 -1
  70. data/lib/appsignal.rb +9 -6
  71. data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
  72. data/spec/lib/appsignal/config_spec.rb +139 -43
  73. data/spec/lib/appsignal/hooks/action_cable_spec.rb +43 -74
  74. data/spec/lib/appsignal/hooks/activejob_spec.rb +9 -0
  75. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +2 -443
  76. data/spec/lib/appsignal/hooks/rake_spec.rb +100 -17
  77. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +0 -171
  78. data/spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb +459 -0
  79. data/spec/lib/appsignal/integrations/padrino_spec.rb +181 -131
  80. data/spec/lib/appsignal/integrations/que_spec.rb +3 -4
  81. data/spec/lib/appsignal/integrations/shoryuken_spec.rb +167 -0
  82. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +4 -4
  83. data/spec/lib/appsignal/integrations/sinatra_spec.rb +10 -2
  84. data/spec/lib/appsignal/integrations/webmachine_spec.rb +77 -17
  85. data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +144 -11
  86. data/spec/lib/appsignal/rack/body_wrapper_spec.rb +263 -0
  87. data/spec/lib/appsignal/rack/event_handler_spec.rb +81 -10
  88. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +70 -17
  89. data/spec/lib/appsignal/rack/grape_middleware_spec.rb +1 -1
  90. data/spec/lib/appsignal/rack/instrumentation_middleware_spec.rb +38 -0
  91. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +4 -2
  92. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +43 -120
  93. data/spec/lib/appsignal/rack_spec.rb +63 -0
  94. data/spec/lib/appsignal/transaction_spec.rb +1675 -953
  95. data/spec/lib/appsignal/utils/integration_logger_spec.rb +12 -16
  96. data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +0 -10
  97. data/spec/lib/appsignal_spec.rb +517 -13
  98. data/spec/support/helpers/transaction_helpers.rb +44 -20
  99. data/spec/support/matchers/transaction.rb +15 -1
  100. data/spec/support/mocks/dummy_app.rb +1 -1
  101. data/spec/support/testing.rb +1 -1
  102. metadata +12 -4
  103. data/support/check_versions +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0c44e1ac2363e7ac8079dfe5141c24243fb5841a4cf39b9844545a57543236a
4
- data.tar.gz: 7ba546cf4f4a92c2ae190ba3e697bf97e34c0bcd01592830285cfaf369503c9c
3
+ metadata.gz: 58edd9ab16d90269a61e7e485e51078b05b60b2192461408d415eafd8327fb04
4
+ data.tar.gz: 92520f55157b13bbe61a98cbcc61901c3c016854a436bd4ae01ad9563d92bf9a
5
5
  SHA512:
6
- metadata.gz: f969c4bb7ff803e02c6b6076287531712aa117b3d0bf95c2e0384ef6ed13363150cde6bb67ad92ce70022e04f4ec327bc788afe1cce3a00206ee8d73fabea0d5
7
- data.tar.gz: '0967f97eba597c995555beb7ffa930678e0f4ce7f4e26a4da02f59571313c52983b747259dd861cc602180d0bb02f238608ac095f44439f4ad6c3d1df8089b0c'
6
+ metadata.gz: 502fd7ada9029f2ecacb0368e8bfe8128fa7792031f1c567f73c05e2381aa1fbc9f946bd7b574352e0114413c724cace05758854725130101122121200ceaaff
7
+ data.tar.gz: 1d90ec5300a657522de4ec3298b3db22a60aadecafda35ffe38ffed72b1ae1d311e590a502ef6d002e99897f2d453e1b0c1d3c9f8569eebd9aa3d90610fce77e
@@ -15,6 +15,8 @@ name: Ruby gem CI
15
15
  - opened
16
16
  - reopened
17
17
  - synchronize
18
+ schedule:
19
+ - cron: 0 0 * * 1-5
18
20
  concurrency:
19
21
  group: "${{ github.workflow }}-${{ github.ref }}"
20
22
  cancel-in-progress: "${{ !contains(github.ref, 'main')}}"
@@ -22,6 +24,7 @@ jobs:
22
24
  lint-git:
23
25
  name: Git linter (Lintje)
24
26
  runs-on: ubuntu-latest
27
+ if: "${{ github.event_name != 'schedule' }}"
25
28
  steps:
26
29
  - uses: actions/checkout@v4
27
30
  with:
@@ -2996,8 +2999,8 @@ jobs:
2996
2999
  JRUBY_OPTS: ''
2997
3000
  COV: '1'
2998
3001
  BUNDLE_GEMFILE: gemfiles/redis-5.gemfile
2999
- ruby_jruby-9-4-1-0:
3000
- name: Ruby jruby-9.4.1.0
3002
+ ruby_jruby-9-4-7-0:
3003
+ name: Ruby jruby-9.4.7.0
3001
3004
  needs: validation
3002
3005
  runs-on: ubuntu-latest
3003
3006
  steps:
@@ -3006,7 +3009,7 @@ jobs:
3006
3009
  - name: Install Ruby
3007
3010
  uses: ruby/setup-ruby@v1
3008
3011
  with:
3009
- ruby-version: jruby-9.4.1.0
3012
+ ruby-version: jruby-9.4.7.0
3010
3013
  bundler-cache: true
3011
3014
  - name: Install gem extension
3012
3015
  run: "./support/bundler_wrapper exec rake extension:install"
@@ -3025,9 +3028,9 @@ jobs:
3025
3028
  JRUBY_OPTS: ''
3026
3029
  COV: '1'
3027
3030
  BUNDLE_GEMFILE: gemfiles/no_dependencies.gemfile
3028
- ruby_jruby-9-4-1-0__rails-6-0:
3029
- name: Ruby jruby-9.4.1.0 - rails-6.0
3030
- needs: ruby_jruby-9-4-1-0
3031
+ ruby_jruby-9-4-7-0__rails-6-0:
3032
+ name: Ruby jruby-9.4.7.0 - rails-6.0
3033
+ needs: ruby_jruby-9-4-7-0
3031
3034
  runs-on: ubuntu-latest
3032
3035
  steps:
3033
3036
  - name: Check out repository
@@ -3035,7 +3038,7 @@ jobs:
3035
3038
  - name: Install Ruby
3036
3039
  uses: ruby/setup-ruby@v1
3037
3040
  with:
3038
- ruby-version: jruby-9.4.1.0
3041
+ ruby-version: jruby-9.4.7.0
3039
3042
  bundler-cache: true
3040
3043
  - name: Install gem extension
3041
3044
  run: "./support/bundler_wrapper exec rake extension:install"
@@ -3052,9 +3055,9 @@ jobs:
3052
3055
  JRUBY_OPTS: ''
3053
3056
  COV: '1'
3054
3057
  BUNDLE_GEMFILE: gemfiles/rails-6.0.gemfile
3055
- ruby_jruby-9-4-1-0__rails-6-1:
3056
- name: Ruby jruby-9.4.1.0 - rails-6.1
3057
- needs: ruby_jruby-9-4-1-0
3058
+ ruby_jruby-9-4-7-0__rails-6-1:
3059
+ name: Ruby jruby-9.4.7.0 - rails-6.1
3060
+ needs: ruby_jruby-9-4-7-0
3058
3061
  runs-on: ubuntu-latest
3059
3062
  steps:
3060
3063
  - name: Check out repository
@@ -3062,7 +3065,7 @@ jobs:
3062
3065
  - name: Install Ruby
3063
3066
  uses: ruby/setup-ruby@v1
3064
3067
  with:
3065
- ruby-version: jruby-9.4.1.0
3068
+ ruby-version: jruby-9.4.7.0
3066
3069
  bundler-cache: true
3067
3070
  - name: Install gem extension
3068
3071
  run: "./support/bundler_wrapper exec rake extension:install"
@@ -3079,9 +3082,9 @@ jobs:
3079
3082
  JRUBY_OPTS: ''
3080
3083
  COV: '1'
3081
3084
  BUNDLE_GEMFILE: gemfiles/rails-6.1.gemfile
3082
- ruby_jruby-9-4-1-0__rails-7-0:
3083
- name: Ruby jruby-9.4.1.0 - rails-7.0
3084
- needs: ruby_jruby-9-4-1-0
3085
+ ruby_jruby-9-4-7-0__rails-7-0:
3086
+ name: Ruby jruby-9.4.7.0 - rails-7.0
3087
+ needs: ruby_jruby-9-4-7-0
3085
3088
  runs-on: ubuntu-latest
3086
3089
  steps:
3087
3090
  - name: Check out repository
@@ -3089,7 +3092,7 @@ jobs:
3089
3092
  - name: Install Ruby
3090
3093
  uses: ruby/setup-ruby@v1
3091
3094
  with:
3092
- ruby-version: jruby-9.4.1.0
3095
+ ruby-version: jruby-9.4.7.0
3093
3096
  bundler-cache: true
3094
3097
  - name: Install gem extension
3095
3098
  run: "./support/bundler_wrapper exec rake extension:install"
@@ -3106,9 +3109,9 @@ jobs:
3106
3109
  JRUBY_OPTS: ''
3107
3110
  COV: '1'
3108
3111
  BUNDLE_GEMFILE: gemfiles/rails-7.0.gemfile
3109
- ruby_jruby-9-4-1-0__rails-7-1:
3110
- name: Ruby jruby-9.4.1.0 - rails-7.1
3111
- needs: ruby_jruby-9-4-1-0
3112
+ ruby_jruby-9-4-7-0__rails-7-1:
3113
+ name: Ruby jruby-9.4.7.0 - rails-7.1
3114
+ needs: ruby_jruby-9-4-7-0
3112
3115
  runs-on: ubuntu-latest
3113
3116
  steps:
3114
3117
  - name: Check out repository
@@ -3116,7 +3119,7 @@ jobs:
3116
3119
  - name: Install Ruby
3117
3120
  uses: ruby/setup-ruby@v1
3118
3121
  with:
3119
- ruby-version: jruby-9.4.1.0
3122
+ ruby-version: jruby-9.4.7.0
3120
3123
  bundler-cache: true
3121
3124
  - name: Install gem extension
3122
3125
  run: "./support/bundler_wrapper exec rake extension:install"
data/.rubocop.yml CHANGED
@@ -6,6 +6,7 @@ AllCops:
6
6
  Include:
7
7
  - "**/*.rb"
8
8
  - "**/*.cap"
9
+ - "**/*.rake"
9
10
  - "**/Gemfile"
10
11
  - "**/Rakefile"
11
12
  - "appsignal.gemspec"
@@ -13,7 +14,6 @@ AllCops:
13
14
  - "pkg/**/*"
14
15
  - "tmp/**/*"
15
16
  - "vendor/**/*"
16
- - "benchmark.rake"
17
17
  - "spec/integration/diagnose/**/*"
18
18
  DisplayCopNames: true
19
19
  UseCache: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,185 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.11.0
4
+
5
+ _Published on 2024-07-15._
6
+
7
+ ### Added
8
+
9
+ - Add `Appsignal.monitor` and `Appsignal.monitor_and_stop` instrumentation helpers. These helpers are a replacement for the `Appsignal.monitor_transaction` and `Appsignal.monitor_single_transaction` helpers.
10
+
11
+ Use these new helpers to create an AppSignal transaction and track any exceptions that occur within the instrumented block. This new helper supports custom namespaces and has a simpler way to set an action name. Use this helper in combination with our other `Appsignal.set_*` helpers to add more metadata to the transaction.
12
+
13
+ ```ruby
14
+ # New helper
15
+ Appsignal.monitor(
16
+ :namespace => "my_namespace",
17
+ :action => "MyClass#my_method"
18
+ ) do
19
+ # Track an instrumentation event
20
+ Appsignal.instrument("my_event.my_group") do
21
+ # Some code
22
+ end
23
+ end
24
+
25
+ # Old helper
26
+ Appsignal.monitor_transaction(
27
+ "process_action.my_group",
28
+ :class_name => "MyClass",
29
+ :action_name => "my_method"
30
+ ) do
31
+ # Some code
32
+ end
33
+ ```
34
+
35
+ The `Appsignal.monitor_and_stop` helper can be used in the same scenarios as the `Appsignal.monitor_single_transaction` helper is used. One-off Ruby scripts that are not part of a long running process.
36
+
37
+ Read our [instrumentation documentation](https://docs.appsignal.com/ruby/instrumentation/background-jobs.html) for more information about using the`Appsignal.monitor` helper.
38
+
39
+ (minor [f38f0cff](https://github.com/appsignal/appsignal-ruby/commit/f38f0cff978c7e7244beae347a8355fff19b13f1))
40
+ - Add `Appsignal.set_session_data` helper. Set custom session data on the current transaction with the `Appsignal.set_session_data` helper. Note that this will overwrite any request session data that would be set automatically on the transaction. When this method is called multiple times, it will overwrite the previously set value.
41
+
42
+ ```ruby
43
+ Appsignal.set_session_data("data1" => "value1", "data2" => "value2")
44
+ ```
45
+
46
+ (patch [48c76635](https://github.com/appsignal/appsignal-ruby/commit/48c76635043a3777de79816bdb2154ad392c1b09))
47
+ - Add `Appsignal.set_headers` helper. Set custom request headers on the current transaction with the `Appsignal.set_headers` helper. Note that this will overwrite any request headers that would be set automatically on the transaction. When this method is called multiple times, it will overwrite the previously set value.
48
+
49
+ ```ruby
50
+ Appsignal.set_headers("PATH_INFO" => "/some-path", "HTTP_USER_AGENT" => "Firefox")
51
+ ```
52
+
53
+ (patch [7d82dffd](https://github.com/appsignal/appsignal-ruby/commit/7d82dffd75a6c7c9a8b6a8fac7e6bbb70104b63c))
54
+ - Report request headers for webmachine apps. (patch [fcfb7a0d](https://github.com/appsignal/appsignal-ruby/commit/fcfb7a0d2545a2144aa61efa61d445c0e11c7749))
55
+
56
+ ### Changed
57
+
58
+ - Allow tags to have boolean (true/false) values.
59
+
60
+ ```ruby
61
+ Appsignal.set_tags("my_tag_is_amazing" => true)
62
+ Appsignal.set_tags("my_tag_is_false" => false)
63
+ ```
64
+
65
+ (patch [1b8e86cb](https://github.com/appsignal/appsignal-ruby/commit/1b8e86cba3472ebec78680ca6a2ed8aa76938724))
66
+ - Optimize Sidekiq job arguments being recorded. Job arguments are only fetched and set when we sample the job transaction, which should decrease our overhead for all jobs we don't sample. (patch [3f957301](https://github.com/appsignal/appsignal-ruby/commit/3f95730145d6eef7eb13901853685e4d56d5495c))
67
+
68
+ ### Deprecated
69
+
70
+ - Deprecate Transaction sample helpers: `Transaction#set_sample_data` and `Transaction#sample_data`. Please use one of the other sample data helpers instead. See our [sample data guide](https://docs.appsignal.com/guides/custom-data/sample-data.html). (patch [2d2e0e43](https://github.com/appsignal/appsignal-ruby/commit/2d2e0e43c9125b4566e3265b6e6ae85e4910652b))
71
+ - Deprecate the `Appsignal::Transaction#set_http_or_background_queue_start` method. Use the `Appsignal::Transaction#set_queue_start` helper instead. (patch [d93e0370](https://github.com/appsignal/appsignal-ruby/commit/d93e0370ff4e37cf8d12652a6e5cca66651a5790))
72
+ - Deprecate the `Appsignal.without_instrumentation` helper. Use the `Appsignal.ignore_instrumentation_events` helper instead. (patch [7cc3c0e4](https://github.com/appsignal/appsignal-ruby/commit/7cc3c0e41615394deec348d5e0a40b7a6c1fc1d9))
73
+ - Deprecate the `Appsignal::Transaction::GenericRequest` class. Use the `Appsignal.set_*` helpers to set metadata on the Transaction instead. Read our [sample data guide](https://docs.appsignal.com/guides/custom-data/sample-data.html) for more information. (patch [1c69d3fd](https://github.com/appsignal/appsignal-ruby/commit/1c69d3fdf47959c240c4732f7e8551802a9eba63))
74
+ - Deprecate the 'ID', 'request', and 'options' arguments for the `Transaction.create` and `Transaction.new` methods. To add metadata to the transaction, use the `Appsignal.set_*` helpers. Read our [sample data guide](https://docs.appsignal.com/guides/custom-data/sample-data.html) for more information on how to set metadata on transactions.
75
+
76
+ ```ruby
77
+ # Before
78
+ Appsignal::Transaction.create(
79
+ SecureRandom.uuid,
80
+ "my_namespace",
81
+ Appsignal::Transaction::GenericRequest.new(env) # env is a request env Hash
82
+ )
83
+
84
+ # After
85
+ Appsignal::Transaction.create("my_namespace")
86
+ ```
87
+
88
+ (patch [2fc2c617](https://github.com/appsignal/appsignal-ruby/commit/2fc2c617321bc6a520205cae0cfa42fb3c8fc5d8))
89
+ - Deprecate the `Appsignal.monitor_transaction` and `Appsignal.monitor_single_transaction` helpers. See the entry about the replacement helpers `Appsignal.monitor` and `Appsignal.monitor_and_stop`. (patch [470d5813](https://github.com/appsignal/appsignal-ruby/commit/470d58132270115215093c9cffd16e52829ef4c4))
90
+
91
+ ## 3.10.0
92
+
93
+ _Published on 2024-07-08._
94
+
95
+ ### Added
96
+
97
+ - 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.
98
+
99
+ 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.
100
+
101
+ ```ruby
102
+ # config.ru
103
+
104
+ # Setup AppSignal
105
+
106
+ use Appsignal::Rack::InstrumentationMiddleware
107
+
108
+ # Run app
109
+ ```
110
+
111
+ (minor [f2596781](https://github.com/appsignal/appsignal-ruby/commit/f259678111067bd3d7cf60552201f4d4f95a99d6))
112
+ - 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))
113
+ - 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.
114
+
115
+ This Sinatra route with a streaming response will be better instrumented, for example:
116
+
117
+ ```ruby
118
+ get "/stream" do
119
+ stream do |out|
120
+ sleep 1
121
+ out << "1"
122
+ sleep 1
123
+ out << "2"
124
+ sleep 1
125
+ out << "3"
126
+ end
127
+ end
128
+ ```
129
+
130
+ (minor [bd2f037b](https://github.com/appsignal/appsignal-ruby/commit/bd2f037ba4840f4606373ee2fc11553f098d5436))
131
+ - 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))
132
+ - 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))
133
+ - 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.
134
+ Report the response status for Padrino requests as the `response_status` metric.
135
+
136
+ (patch [9239c26b](https://github.com/appsignal/appsignal-ruby/commit/9239c26beb144b9d8bf094bc58030cd618633c38))
137
+ - 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))
138
+ - 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.
139
+
140
+ ```ruby
141
+ Appsignal.set_params("param1" => "value1", "param2" => "value2")
142
+ ```
143
+
144
+ (patch [e8d73e8d](https://github.com/appsignal/appsignal-ruby/commit/e8d73e8d31264c44dd5db5d769be6b599b0ded48))
145
+ - 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))
146
+ - 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))
147
+ - 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.
148
+
149
+ ```ruby
150
+ Appsignal.set_params do
151
+ # Some slow code to parse parameters
152
+ JSON.parse('{"param1": "value1"}')
153
+ end
154
+ ```
155
+
156
+ (patch [1502ea14](https://github.com/appsignal/appsignal-ruby/commit/1502ea147210d77dd4ee9d301c52ace30c2a6700))
157
+
158
+ ### Deprecated
159
+
160
+ - Deprecate the `appsignal.action` and `appsignal.route` request env methods to set the transaction action name. Use the `Appsignal.set_action` helper instead.
161
+
162
+ ```ruby
163
+ # Before
164
+ env["appsignal.action"] = "POST /my-action"
165
+ env["appsignal.route"] = "POST /my-action"
166
+
167
+ # After
168
+ Appsignal.set_action("POST /my-action")
169
+ ```
170
+
171
+ (patch [1e6d0b31](https://github.com/appsignal/appsignal-ruby/commit/1e6d0b315577176d4dd37db0a8f5fde89c66e8a4))
172
+ - Deprecate the `Appsignal::Rack::StreamingListener` middleware. Use the `Appsignal::Rack::InstrumentationMiddleware` middleware instead. (patch [57d6fa33](https://github.com/appsignal/appsignal-ruby/commit/57d6fa3386d9a9720da76c7b899a332952d472e0))
173
+ - 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))
174
+
175
+ ### Fixed
176
+
177
+ - Fix issue with AppSignal getting stuck in a boot loop when loading the Padrino integration with: `require "appsignal/integrations/padrino"`
178
+ This could happen in nested applications, like a Padrino app in a Rails app. AppSignal will now use the first config AppSignal starts with.
179
+
180
+ (patch [10722b60](https://github.com/appsignal/appsignal-ruby/commit/10722b60d0ad9dc63b2c7add7d5ee8703190b8f0))
181
+ - Fix the deprecation warning of `Bundler.rubygems.all_specs` usage. (patch [1502ea14](https://github.com/appsignal/appsignal-ruby/commit/1502ea147210d77dd4ee9d301c52ace30c2a6700))
182
+
3
183
  ## 3.9.3
4
184
 
5
185
  _Published on 2024-07-02._
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
+ gem "benchmark-ips"
7
8
  # Fix install issue for jruby on gem 3.1.8.
8
9
  # No java stub is published.
9
10
  gem "bigdecimal", "3.1.7" if RUBY_PLATFORM == "java"
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
@@ -127,7 +127,7 @@ namespace :build_matrix do
127
127
  output = `git status`
128
128
  if output.include? GITHUB_ACTION_WORKFLOW_FILE
129
129
  puts "The `#{GITHUB_ACTION_WORKFLOW_FILE}` is modified. The changes were not committed."
130
- puts "Please run `rake build_matrix:semaphore:generate` and commit the changes."
130
+ puts "Please run `rake build_matrix:github:generate` and commit the changes."
131
131
  exit 1
132
132
  end
133
133
  end
data/benchmark.rake CHANGED
@@ -1,5 +1,12 @@
1
- require 'appsignal'
2
- require 'benchmark'
1
+ # frozen_string_literal: true
2
+
3
+ # Run using: rake --rakefile benchmark.rake [tasks]
4
+
5
+ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "lib"))
6
+
7
+ require "benchmark"
8
+ require "benchmark/ips"
9
+ require "appsignal"
3
10
 
4
11
  def process_rss
5
12
  `ps -o rss= -p #{Process.pid}`.to_i
@@ -7,35 +14,110 @@ end
7
14
 
8
15
  GC.disable
9
16
 
10
- task :default => :'benchmark:all'
17
+ task :default => :"benchmark:all"
11
18
 
12
19
  namespace :benchmark do
13
- task :all => [:run_inactive, :run_active]
20
+ task :all => [:memory_inactive, :memory_active, :ips]
14
21
 
15
- task :run_inactive do
16
- puts 'Running with appsignal off'
17
- ENV['APPSIGNAL_PUSH_API_KEY'] = nil
22
+ task :memory_inactive do
23
+ puts "Memory benchmark with AppSignal off"
24
+ ENV["APPSIGNAL_PUSH_API_KEY"] = nil
18
25
  run_benchmark
19
26
  end
20
27
 
21
- task :run_active do
22
- puts 'Running with appsignal on'
23
- ENV['APPSIGNAL_PUSH_API_KEY'] = 'something'
28
+ task :memory_active do
29
+ puts "Memory benchmark with AppSignal on"
30
+ ENV["APPSIGNAL_PUSH_API_KEY"] = "something"
24
31
  run_benchmark
25
32
  end
33
+
34
+ task :ips do
35
+ puts "Iterations per second benchmark"
36
+ start_agent
37
+ Benchmark.ips do |x|
38
+ x.config(
39
+ :time => 5,
40
+ :warmup => 2
41
+ )
42
+
43
+ x.report("monitor transaction inactive") do |times|
44
+ ENV["APPSIGNAL_PUSH_API_KEY"] = nil
45
+
46
+ monitor_transaction("transaction_#{times}")
47
+ end
48
+
49
+ x.report("monitor transaction active") do |times|
50
+ ENV["APPSIGNAL_PUSH_API_KEY"] = "something"
51
+
52
+ monitor_transaction("transaction_#{times}")
53
+ end
54
+
55
+ x.compare!
56
+ end
57
+ end
58
+ end
59
+
60
+ def start_agent
61
+ Appsignal.config = Appsignal::Config.new(
62
+ Dir.pwd,
63
+ "production",
64
+ :endpoint => "http://localhost:8080"
65
+ )
66
+ Appsignal.start
67
+ end
68
+
69
+ def monitor_transaction(transaction_id)
70
+ transaction = Appsignal::Transaction.create(
71
+ transaction_id,
72
+ Appsignal::Transaction::HTTP_REQUEST
73
+ )
74
+ transaction.set_action("HomeController#show")
75
+ transaction.set_params(:id => 1)
76
+
77
+ Appsignal.instrument("process_action.action_controller") do
78
+ Appsignal.instrument_sql(
79
+ "sql.active_record",
80
+ nil,
81
+ "SELECT `users`.* FROM `users` WHERE `users`.`id` = ?"
82
+ )
83
+ 10.times do
84
+ Appsignal.instrument_sql(
85
+ "sql.active_record",
86
+ nil,
87
+ "SELECT `todos`.* FROM `todos` WHERE `todos`.`id` = ?"
88
+ )
89
+ end
90
+
91
+ Appsignal.instrument(
92
+ "render_template.action_view",
93
+ "app/views/home/show.html.erb"
94
+ ) do
95
+ 5.times do
96
+ Appsignal.instrument(
97
+ "render_partial.action_view",
98
+ "app/views/home/_piece.html.erb"
99
+ ) do
100
+ 3.times do
101
+ Appsignal.instrument("cache.read")
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+
108
+ Appsignal::Transaction.complete_current!
26
109
  end
27
110
 
28
111
  def run_benchmark
29
- no_transactions = (ENV['NO_TRANSACTIONS'] || 100_000).to_i
30
- no_threads = (ENV['NO_THREADS'] || 1).to_i
112
+ no_transactions = (ENV["NO_TRANSACTIONS"] || 100_000).to_i
113
+ no_threads = (ENV["NO_THREADS"] || 1).to_i
31
114
 
32
115
  total_objects = ObjectSpace.count_objects[:TOTAL]
33
116
  puts "Initializing, currently #{total_objects} objects"
34
117
  puts "RSS: #{process_rss}"
35
118
 
36
- Appsignal.config = Appsignal::Config.new(Dir.pwd, 'production', :endpoint => 'http://localhost:8080')
37
- Appsignal.start
38
- puts "Appsignal #{Appsignal.active? ? 'active' : 'not active'}"
119
+ start_agent
120
+ puts "Appsignal #{Appsignal.active? ? "active" : "not active"}"
39
121
 
40
122
  threads = []
41
123
  puts "Running #{no_transactions} normal transactions in #{no_threads} threads"
@@ -43,39 +125,14 @@ def run_benchmark
43
125
  no_threads.times do
44
126
  thread = Thread.new do
45
127
  no_transactions.times do |i|
46
- request = Appsignal::Transaction::GenericRequest.new(
47
- :controller => 'HomeController',
48
- :action => 'show',
49
- :params => {:id => 1}
50
- )
51
- Appsignal::Transaction.create("transaction_#{i}", Appsignal::Transaction::HTTP_REQUEST, request)
52
-
53
- Appsignal.instrument('process_action.action_controller') do
54
- Appsignal.instrument_sql('sql.active_record', nil, 'SELECT `users`.* FROM `users` WHERE `users`.`id` = ?')
55
- 10.times do
56
- Appsignal.instrument_sql('sql.active_record', nil, 'SELECT `todos`.* FROM `todos` WHERE `todos`.`id` = ?')
57
- end
58
-
59
- Appsignal.instrument('render_template.action_view', 'app/views/home/show.html.erb') do
60
- 5.times do
61
- Appsignal.instrument('render_partial.action_view', 'app/views/home/_piece.html.erb') do
62
- 3.times do
63
- Appsignal.instrument('cache.read')
64
- end
65
- end
66
- end
67
- end
68
- end
69
-
70
- Appsignal::Transaction.complete_current!
128
+ monitor_transaction("transaction_#{i}")
71
129
  end
72
130
  end
73
131
  thread.abort_on_exception = true
74
132
  threads << thread
75
133
  end
76
-
77
134
  threads.each(&:join)
78
- puts 'Finished'
135
+ puts "Finished"
79
136
  end)
80
137
 
81
138
  puts "Done, currently #{ObjectSpace.count_objects[:TOTAL] - total_objects} objects created"
data/build_matrix.yml CHANGED
@@ -2,14 +2,11 @@ github:
2
2
  name: Ruby gem CI
3
3
  "on":
4
4
  push:
5
- branches:
6
- - "main"
7
- - "develop"
5
+ branches: ["main", "develop"]
8
6
  pull_request:
9
- types:
10
- - opened
11
- - reopened
12
- - synchronize
7
+ types: [opened, reopened, synchronize]
8
+ schedule:
9
+ - cron: "0 0 * * 1-5"
13
10
 
14
11
  concurrency:
15
12
  group: ${{ github.workflow }}-${{ github.ref }}
@@ -19,6 +16,7 @@ github:
19
16
  lint-git:
20
17
  name: "Git linter (Lintje)"
21
18
  runs-on: ubuntu-latest
19
+ if: ${{ github.event_name != 'schedule' }}
22
20
  steps:
23
21
  - uses: actions/checkout@v4
24
22
  with:
@@ -93,7 +91,7 @@ matrix:
93
91
  - ruby: "3.1.3"
94
92
  - ruby: "3.0.5"
95
93
  - ruby: "2.7.8"
96
- - ruby: "jruby-9.4.1.0"
94
+ - ruby: "jruby-9.4.7.0"
97
95
  gems: "minimal"
98
96
  gems:
99
97
  - gem: "no_dependencies"
@@ -146,7 +144,7 @@ matrix:
146
144
  ruby:
147
145
  - "3.0.5"
148
146
  - "2.7.8"
149
- - "jruby-9.4.1.0"
147
+ - "jruby-9.4.7.0"
150
148
  - gem: "rails-6.1"
151
149
  only:
152
150
  ruby:
@@ -155,7 +153,7 @@ matrix:
155
153
  - "3.1.3"
156
154
  - "3.0.5"
157
155
  - "2.7.8"
158
- - "jruby-9.4.1.0"
156
+ - "jruby-9.4.7.0"
159
157
  - gem: "rails-7.0"
160
158
  only:
161
159
  ruby:
@@ -164,7 +162,7 @@ matrix:
164
162
  - "3.1.3"
165
163
  - "3.0.5"
166
164
  - "2.7.8"
167
- - "jruby-9.4.1.0"
165
+ - "jruby-9.4.7.0"
168
166
  - gem: "rails-7.1"
169
167
  only:
170
168
  ruby:
@@ -172,7 +170,7 @@ matrix:
172
170
  - "3.2.1"
173
171
  - "3.1.3"
174
172
  - "3.0.5"
175
- - "jruby-9.4.1.0"
173
+ - "jruby-9.4.7.0"
176
174
  - gem: "sequel"
177
175
  - gem: "sinatra"
178
176
  - gem: "webmachine1"
@@ -1,6 +1,7 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- gem 'webmachine', '~> 1.6'
4
- gem 'webrick'
3
+ gem "i18n", "~> 0.0" # Lock to pre 1.x version as it's not compatible
4
+ gem "webmachine", "~> 1.6"
5
+ gem "webrick"
5
6
 
6
- gemspec :path => '../'
7
+ gemspec :path => "../"
@@ -39,7 +39,6 @@ module Appsignal
39
39
  # AppSignal demo documentation
40
40
  # @see https://docs.appsignal.com/support/debugging.html
41
41
  # Debugging AppSignal guide
42
- # @api private
43
42
  class Demo
44
43
  class << self
45
44
  # @param options [Hash]