appsignal 3.10.0-java → 3.12.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +197 -0
- data/Gemfile +1 -0
- data/Rakefile +1 -1
- data/benchmark.rake +99 -42
- data/lib/appsignal/cli/demo.rb +0 -1
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +204 -130
- data/lib/appsignal/demo.rb +16 -26
- data/lib/appsignal/event_formatter/rom/sql_formatter.rb +1 -0
- data/lib/appsignal/event_formatter.rb +3 -2
- data/lib/appsignal/helpers/instrumentation.rb +331 -19
- data/lib/appsignal/hooks/action_cable.rb +21 -16
- data/lib/appsignal/hooks/active_job.rb +14 -8
- data/lib/appsignal/hooks/delayed_job.rb +1 -1
- data/lib/appsignal/hooks/shoryuken.rb +3 -63
- data/lib/appsignal/integrations/action_cable.rb +5 -7
- data/lib/appsignal/integrations/active_support_notifications.rb +1 -0
- data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +36 -35
- data/lib/appsignal/integrations/data_mapper.rb +1 -0
- data/lib/appsignal/integrations/delayed_job_plugin.rb +27 -33
- data/lib/appsignal/integrations/dry_monitor.rb +1 -0
- data/lib/appsignal/integrations/excon.rb +1 -0
- data/lib/appsignal/integrations/grape.rb +7 -0
- data/lib/appsignal/integrations/hanami.rb +8 -43
- data/lib/appsignal/integrations/http.rb +1 -0
- data/lib/appsignal/integrations/net_http.rb +1 -0
- data/lib/appsignal/integrations/object.rb +6 -0
- data/lib/appsignal/integrations/padrino.rb +8 -73
- data/lib/appsignal/integrations/que.rb +13 -20
- data/lib/appsignal/integrations/railtie.rb +36 -14
- data/lib/appsignal/integrations/rake.rb +1 -5
- data/lib/appsignal/integrations/redis.rb +1 -0
- data/lib/appsignal/integrations/redis_client.rb +1 -0
- data/lib/appsignal/integrations/resque.rb +2 -5
- data/lib/appsignal/integrations/shoryuken.rb +75 -0
- data/lib/appsignal/integrations/sidekiq.rb +7 -15
- data/lib/appsignal/integrations/sinatra.rb +8 -19
- data/lib/appsignal/integrations/unicorn.rb +1 -0
- data/lib/appsignal/integrations/webmachine.rb +2 -5
- data/lib/appsignal/loaders/grape.rb +13 -0
- data/lib/appsignal/loaders/hanami.rb +40 -0
- data/lib/appsignal/loaders/padrino.rb +68 -0
- data/lib/appsignal/loaders/sinatra.rb +24 -0
- data/lib/appsignal/loaders.rb +92 -0
- data/lib/appsignal/logger.rb +7 -3
- data/lib/appsignal/probes/helpers.rb +1 -0
- data/lib/appsignal/probes/mri.rb +1 -0
- data/lib/appsignal/probes/sidekiq.rb +1 -0
- data/lib/appsignal/probes.rb +3 -0
- data/lib/appsignal/rack/abstract_middleware.rb +20 -13
- data/lib/appsignal/rack/event_handler.rb +44 -13
- data/lib/appsignal/rack/generic_instrumentation.rb +1 -0
- data/lib/appsignal/rack/grape_middleware.rb +2 -1
- data/lib/appsignal/rack/streaming_listener.rb +1 -0
- data/lib/appsignal/rack.rb +35 -0
- data/lib/appsignal/span.rb +1 -0
- data/lib/appsignal/transaction.rb +308 -101
- data/lib/appsignal/utils/data.rb +0 -1
- data/lib/appsignal/utils/hash_sanitizer.rb +0 -1
- data/lib/appsignal/utils/integration_logger.rb +0 -13
- data/lib/appsignal/utils/integration_memory_logger.rb +0 -13
- data/lib/appsignal/utils/json.rb +0 -1
- data/lib/appsignal/utils/query_params_sanitizer.rb +0 -1
- data/lib/appsignal/utils/stdout_and_logger_message.rb +0 -1
- data/lib/appsignal/utils.rb +6 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +169 -14
- data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
- data/spec/lib/appsignal/cli/demo_spec.rb +0 -1
- data/spec/lib/appsignal/cli/diagnose/paths_spec.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +0 -1
- data/spec/lib/appsignal/config_spec.rb +291 -44
- data/spec/lib/appsignal/demo_spec.rb +1 -2
- data/spec/lib/appsignal/environment_spec.rb +4 -2
- data/spec/lib/appsignal/hooks/action_cable_spec.rb +43 -74
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +3 -6
- data/spec/lib/appsignal/hooks/activejob_spec.rb +12 -3
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +2 -443
- data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +4 -7
- data/spec/lib/appsignal/hooks/excon_spec.rb +3 -6
- data/spec/lib/appsignal/hooks/gvl_spec.rb +2 -2
- data/spec/lib/appsignal/hooks/http_spec.rb +1 -3
- data/spec/lib/appsignal/hooks/net_http_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/redis_client_spec.rb +5 -8
- data/spec/lib/appsignal/hooks/redis_spec.rb +3 -6
- data/spec/lib/appsignal/hooks/resque_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/sequel_spec.rb +3 -5
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +0 -171
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb +459 -0
- data/spec/lib/appsignal/integrations/grape_spec.rb +36 -0
- data/spec/lib/appsignal/integrations/hanami_spec.rb +9 -178
- data/spec/lib/appsignal/integrations/http_spec.rb +1 -5
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +4 -2
- data/spec/lib/appsignal/integrations/net_http_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/object_spec.rb +1 -3
- data/spec/lib/appsignal/integrations/padrino_spec.rb +8 -330
- data/spec/lib/appsignal/integrations/que_spec.rb +3 -4
- data/spec/lib/appsignal/integrations/railtie_spec.rb +275 -191
- data/spec/lib/appsignal/integrations/shoryuken_spec.rb +167 -0
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +15 -13
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +9 -104
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +13 -1
- data/spec/lib/appsignal/loaders/grape_spec.rb +12 -0
- data/spec/lib/appsignal/loaders/hanami_spec.rb +95 -0
- data/spec/lib/appsignal/loaders/padrino_spec.rb +277 -0
- data/spec/lib/appsignal/loaders/sinatra_spec.rb +47 -0
- data/spec/lib/appsignal/loaders_spec.rb +137 -0
- data/spec/lib/appsignal/probes/sidekiq_spec.rb +1 -1
- data/spec/lib/appsignal/probes_spec.rb +6 -5
- data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +51 -5
- data/spec/lib/appsignal/rack/event_handler_spec.rb +114 -10
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +1 -1
- data/spec/lib/appsignal/rack/grape_middleware_spec.rb +2 -35
- data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +1 -1
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +4 -2
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +3 -3
- data/spec/lib/appsignal/rack_spec.rb +63 -0
- data/spec/lib/appsignal/span_spec.rb +1 -3
- data/spec/lib/appsignal/transaction_spec.rb +1640 -1075
- data/spec/lib/appsignal/utils/integration_logger_spec.rb +12 -16
- data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +0 -10
- data/spec/lib/appsignal_spec.rb +601 -36
- data/spec/lib/puma/appsignal_spec.rb +0 -3
- data/spec/spec_helper.rb +5 -4
- data/spec/support/helpers/config_helpers.rb +2 -1
- data/spec/support/helpers/loader_helper.rb +21 -0
- data/spec/support/helpers/transaction_helpers.rb +44 -20
- data/spec/support/matchers/transaction.rb +15 -1
- data/spec/support/stubs/appsignal/loaders/loader_stub.rb +7 -0
- data/spec/support/testing.rb +47 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f181aa2848ea0540f455f6dcd08f6e5baa6336d8c085aa261007bfff28d2b67d
|
4
|
+
data.tar.gz: 34ba16eb3b7c3b464e10fb9a8533d3b230cfb73550f6a804599e02b96fb909f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 706a467f0f67fc71de5e2a8281216a22ba02d5166c9b64c35451886ff4ff9abadd983e045bc16e06cee64823410612e580180b9098e56a13b55ddb9b28395d9d
|
7
|
+
data.tar.gz: e83be1622f1c5d86748bc3bb93912d79ac2dd66cb6bbe61106aee8965b3aced6c31bc5e25689f52bfa7cb01da9f10e50fb76c47de1934b93cb12b6db705bb661
|
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,202 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.12.0
|
4
|
+
|
5
|
+
_Published on 2024-07-22._
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Add a Rails configuration option to start AppSignal after Rails is initialized. By default, AppSignal will start before the Rails initializers are run. This way it is not possible to configure AppSignal in a Rails initializer using Ruby. To configure AppSignal in a Rails initializer, configure Rails to start AppSignal after it is initialized.
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
# config/application.rb
|
13
|
+
|
14
|
+
# ...
|
15
|
+
|
16
|
+
module MyApp
|
17
|
+
class Application < Rails::Application
|
18
|
+
# Add this line
|
19
|
+
config.appsignal.start_at = :after_initialize
|
20
|
+
|
21
|
+
# Other config
|
22
|
+
end
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
Then, in the initializer:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
# config/initializers/appsignal.rb
|
30
|
+
|
31
|
+
Appsignal.config = Appsignal::Config.new(
|
32
|
+
Rails.root,
|
33
|
+
Rails.env,
|
34
|
+
:ignore_actions => ["My action"]
|
35
|
+
)
|
36
|
+
```
|
37
|
+
|
38
|
+
Be aware that when `start_at` is set to `after_initialize`, AppSignal will not track any errors that occur when the initializers are run and the app fails to start.
|
39
|
+
|
40
|
+
See [our Rails documentation](https://docs.appsignal.com/ruby/integrations/rails.html) for more information.
|
41
|
+
|
42
|
+
(minor [b84a6a36](https://github.com/appsignal/appsignal-ruby/commit/b84a6a3695259b365cde6f69165818a1e1b99197))
|
43
|
+
- Add a new method of configuring AppSignal: `Appsignal.configure`. This new method allows apps to configure AppSignal in Ruby.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# The environment will be auto detected
|
47
|
+
Appsignal.configure do |config|
|
48
|
+
config.activejob_report_errors = "discard"
|
49
|
+
config.sidekiq_report_errors = :discard
|
50
|
+
config.ignore_actions = ["My ignored action", "My other ignored action"]
|
51
|
+
config.request_headers << "MY_HTTP_HEADER"
|
52
|
+
config.send_params = true
|
53
|
+
config.enable_host_metrics = false
|
54
|
+
end
|
55
|
+
|
56
|
+
# Explicitly define which environment to start
|
57
|
+
Appsignal.configure(:production) do |config|
|
58
|
+
# Some config
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
This new method can be used to update config in Ruby. We still recommend to use the `config/appsignal.yml` file to configure AppSignal whenever possible. Apps that use the `Appsignal.config = Appsignal::Config.new(...)` way of configuring AppSignal, should be updated to use the new `Appsignal.configure` method. The `Appsignal::Config.new` method would overwrite the given "initial config" with the config file's config and config read from environment variables. The `Appsignal.configure` method is leading. The config file, environment variables and `Appsignal.configure` methods can all be mixed.
|
63
|
+
|
64
|
+
See [our configuration guide](https://docs.appsignal.com/ruby/configuration.html) for more information.
|
65
|
+
|
66
|
+
(minor [ba60fff9](https://github.com/appsignal/appsignal-ruby/commit/ba60fff9fa5087c78e171a0608beba882e1a4c92))
|
67
|
+
|
68
|
+
### Changed
|
69
|
+
|
70
|
+
- Update the Sinatra, Padrino, Grape and Hanami integration setup for applications. Before this change a "appsignal/integrations/sinatra" file would need to be required to load the AppSignal integration for Sinatra. Similar requires exist for other libraries. This has changed to a new integration load mechanism.
|
71
|
+
|
72
|
+
This new load mechanism makes starting AppSignal more predictable when loading multiple integrations, like those for Sinatra, Padrino, Grape and Hanami.
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
# Sinatra example
|
76
|
+
# Before
|
77
|
+
require "appsignal/integrations/sinatra"
|
78
|
+
|
79
|
+
# After
|
80
|
+
require "appsignal"
|
81
|
+
|
82
|
+
Appsignal.load(:sinatra)
|
83
|
+
Appsignal.start
|
84
|
+
```
|
85
|
+
|
86
|
+
The `require "appsignal/integrations/sinatra"` will still work, but is deprecated in this release.
|
87
|
+
|
88
|
+
See the documentation for the specific libraries for the latest on how to integrate AppSignal.
|
89
|
+
|
90
|
+
- [Grape](https://docs.appsignal.com/ruby/integrations/grape.html)
|
91
|
+
- [Hanami](https://docs.appsignal.com/ruby/integrations/hanami.html)
|
92
|
+
- [Padrino](https://docs.appsignal.com/ruby/integrations/padrino.html)
|
93
|
+
- [Sinatra](https://docs.appsignal.com/ruby/integrations/sinatra.html)
|
94
|
+
|
95
|
+
When using a combination of the libraries listed above, read our [integration guide](https://docs.appsignal.com/ruby/instrumentation/integrating-appsignal.html) on how to load and configure AppSignal for multiple integrations at once.
|
96
|
+
|
97
|
+
(minor [35fff8cb](https://github.com/appsignal/appsignal-ruby/commit/35fff8cb135bf024b3bcf95e497af7dcc0a4cc02))
|
98
|
+
- Disable the AppSignal Rack EventHandler when AppSignal is not active. It would still trigger our instrumentation when AppSignal is not active. This reduces the instrumentation overhead when AppSignal is not active. (patch [03e7c1b2](https://github.com/appsignal/appsignal-ruby/commit/03e7c1b221caa00af1599ae94e1d4055835c94a7))
|
99
|
+
|
100
|
+
### Deprecated
|
101
|
+
|
102
|
+
- Deprecate the `Appsignal.config = Appsignal::Config.new(...)` method of configuring AppSignal. See the changelog entry about `Appsignal.configure { ... }` for the new way to configure AppSignal in Ruby. (minor [ba60fff9](https://github.com/appsignal/appsignal-ruby/commit/ba60fff9fa5087c78e171a0608beba882e1a4c92))
|
103
|
+
- Deprecate the Hanami integration require: `require "appsignal/integrations/hanami"`. Use the new `Appsignal.load(:hanami)` method instead. Read our [Hanami docs](https://docs.appsignal.com/ruby/integrations/hanami.html) for more information. (patch)
|
104
|
+
- Deprecate the Padrino integration require: `require "appsignal/integrations/padrino"`. Use the new `Appsignal.load(:padrino)` method instead. Read our [Padrino docs](https://docs.appsignal.com/ruby/integrations/padrino.html) for more information. (patch)
|
105
|
+
- Deprecate the Sinatra integration require: `require "appsignal/integrations/sinatra"`. Use the new `Appsignal.load(:sinatra)` method instead. Read our [Sinatra docs](https://docs.appsignal.com/ruby/integrations/sinatra.html) for more information. (patch)
|
106
|
+
- Deprecate the Grape integration require: `require "appsignal/integrations/grape"`. Use the new `Appsignal.load(:grape)` method instead. Read our [Grape docs](https://docs.appsignal.com/ruby/integrations/grape.html) for more information. (patch)
|
107
|
+
|
108
|
+
### Fixed
|
109
|
+
|
110
|
+
- Fix instrumentation events for response bodies appearing twice. When multiple instrumentation middleware were mounted in an application, it would create duplicate `process_response_body.rack` events. (patch [24b16517](https://github.com/appsignal/appsignal-ruby/commit/24b16517f3bf5e2911345d5d825a1febb3c7aed7))
|
111
|
+
|
112
|
+
## 3.11.0
|
113
|
+
|
114
|
+
_Published on 2024-07-15._
|
115
|
+
|
116
|
+
### Added
|
117
|
+
|
118
|
+
- 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.
|
119
|
+
|
120
|
+
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.
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
# New helper
|
124
|
+
Appsignal.monitor(
|
125
|
+
:namespace => "my_namespace",
|
126
|
+
:action => "MyClass#my_method"
|
127
|
+
) do
|
128
|
+
# Track an instrumentation event
|
129
|
+
Appsignal.instrument("my_event.my_group") do
|
130
|
+
# Some code
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Old helper
|
135
|
+
Appsignal.monitor_transaction(
|
136
|
+
"process_action.my_group",
|
137
|
+
:class_name => "MyClass",
|
138
|
+
:action_name => "my_method"
|
139
|
+
) do
|
140
|
+
# Some code
|
141
|
+
end
|
142
|
+
```
|
143
|
+
|
144
|
+
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.
|
145
|
+
|
146
|
+
Read our [instrumentation documentation](https://docs.appsignal.com/ruby/instrumentation/background-jobs.html) for more information about using the`Appsignal.monitor` helper.
|
147
|
+
|
148
|
+
(minor [f38f0cff](https://github.com/appsignal/appsignal-ruby/commit/f38f0cff978c7e7244beae347a8355fff19b13f1))
|
149
|
+
- 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.
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
Appsignal.set_session_data("data1" => "value1", "data2" => "value2")
|
153
|
+
```
|
154
|
+
|
155
|
+
(patch [48c76635](https://github.com/appsignal/appsignal-ruby/commit/48c76635043a3777de79816bdb2154ad392c1b09))
|
156
|
+
- 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.
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
Appsignal.set_headers("PATH_INFO" => "/some-path", "HTTP_USER_AGENT" => "Firefox")
|
160
|
+
```
|
161
|
+
|
162
|
+
(patch [7d82dffd](https://github.com/appsignal/appsignal-ruby/commit/7d82dffd75a6c7c9a8b6a8fac7e6bbb70104b63c))
|
163
|
+
- Report request headers for webmachine apps. (patch [fcfb7a0d](https://github.com/appsignal/appsignal-ruby/commit/fcfb7a0d2545a2144aa61efa61d445c0e11c7749))
|
164
|
+
|
165
|
+
### Changed
|
166
|
+
|
167
|
+
- Allow tags to have boolean (true/false) values.
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
Appsignal.set_tags("my_tag_is_amazing" => true)
|
171
|
+
Appsignal.set_tags("my_tag_is_false" => false)
|
172
|
+
```
|
173
|
+
|
174
|
+
(patch [1b8e86cb](https://github.com/appsignal/appsignal-ruby/commit/1b8e86cba3472ebec78680ca6a2ed8aa76938724))
|
175
|
+
- 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))
|
176
|
+
|
177
|
+
### Deprecated
|
178
|
+
|
179
|
+
- 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))
|
180
|
+
- 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))
|
181
|
+
- Deprecate the `Appsignal.without_instrumentation` helper. Use the `Appsignal.ignore_instrumentation_events` helper instead. (patch [7cc3c0e4](https://github.com/appsignal/appsignal-ruby/commit/7cc3c0e41615394deec348d5e0a40b7a6c1fc1d9))
|
182
|
+
- 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))
|
183
|
+
- 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.
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
# Before
|
187
|
+
Appsignal::Transaction.create(
|
188
|
+
SecureRandom.uuid,
|
189
|
+
"my_namespace",
|
190
|
+
Appsignal::Transaction::GenericRequest.new(env) # env is a request env Hash
|
191
|
+
)
|
192
|
+
|
193
|
+
# After
|
194
|
+
Appsignal::Transaction.create("my_namespace")
|
195
|
+
```
|
196
|
+
|
197
|
+
(patch [2fc2c617](https://github.com/appsignal/appsignal-ruby/commit/2fc2c617321bc6a520205cae0cfa42fb3c8fc5d8))
|
198
|
+
- 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))
|
199
|
+
|
3
200
|
## 3.10.0
|
4
201
|
|
5
202
|
_Published on 2024-07-08._
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/benchmark.rake
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
-
|
2
|
-
|
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 => :
|
17
|
+
task :default => :"benchmark:all"
|
11
18
|
|
12
19
|
namespace :benchmark do
|
13
|
-
task :all => [:
|
20
|
+
task :all => [:memory_inactive, :memory_active, :ips]
|
14
21
|
|
15
|
-
task :
|
16
|
-
puts
|
17
|
-
ENV[
|
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 :
|
22
|
-
puts
|
23
|
-
ENV[
|
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[
|
30
|
-
no_threads = (ENV[
|
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
|
-
|
37
|
-
Appsignal.
|
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
|
-
|
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
|
135
|
+
puts "Finished"
|
79
136
|
end)
|
80
137
|
|
81
138
|
puts "Done, currently #{ObjectSpace.count_objects[:TOTAL] - total_objects} objects created"
|
data/lib/appsignal/cli/demo.rb
CHANGED
@@ -194,7 +194,7 @@ module Appsignal
|
|
194
194
|
initial_config[:log_path] = current_path.join("log")
|
195
195
|
end
|
196
196
|
|
197
|
-
Appsignal.
|
197
|
+
Appsignal._config = Appsignal::Config.new(
|
198
198
|
current_path,
|
199
199
|
options.fetch(:environment, ENV.fetch("RACK_ENV", ENV.fetch("RAILS_ENV", nil))),
|
200
200
|
initial_config
|