appsignal 3.0.25-java → 3.1.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Added
6
+
7
+ - [d10c3f32](https://github.com/appsignal/appsignal-ruby/commit/d10c3f32facbf399d7afe1d2ddbb5764fb57b008) minor - Add tracking of thread counts, garbage collection runs, heap slots and other garbage collection stats to the default MRI probe. These metrics will be shown in AppSignal.com in a new Ruby VM Magic Dashboard.
8
+
9
+ ### Changed
10
+
11
+ - [114fe4f9](https://github.com/appsignal/appsignal-ruby/commit/114fe4f92e621bc2e771bb0fb608b5c6189f2933) patch - Bump agent to v-d573c9b
12
+
13
+ - Display unsupported OpenTelemetry spans in limited form.
14
+ - Clean up payload storage before sending. Should fix issues with locally queued payloads blocking data from being sent.
15
+ - Add `appsignal_create_opentelemetry_span` function to create spans for further modification, rather than only import them.
16
+ - [dd803449](https://github.com/appsignal/appsignal-ruby/commit/dd803449bd3990ba020c0bec4429166977071c02) patch - Report gauge delta value for allocated objects. This reports a more user friendly metric we can graph with a more stable continuous value in apps with stable memory allocation.
17
+ - [547f925e](https://github.com/appsignal/appsignal-ruby/commit/547f925e392bb9f4f10ba95f371e42ddfe0de5de) patch - Report gauge delta value for Garbage Collection counts. This reports a more user friendly metric that doesn't always goes up until the app restarts or gets a new deploy.
18
+
19
+ ### Fixed
20
+
21
+ - [e555a81a](https://github.com/appsignal/appsignal-ruby/commit/e555a81ab65cc951383f54d0e9a6c57d8cc2ac51) patch - Fix FFI function calls missing arguments for `appsignal_free_transaction` and `appsignal_free_data` extension functions. This fixes a high CPU issue when these function calls would be retried indefinitely.
22
+
23
+ ## 3.0.27
24
+
25
+ ### Fixed
26
+
27
+ - [7032dc4b](https://github.com/appsignal/appsignal-ruby/commit/7032dc4b45c150c58a7a97c44b17e1092934c1ec) patch - Use `Dir.pwd` to determine the current directory in the Capistrano 3 integration. It previously relied on `ENV["pwd"]` which returned `nil` in some scenarios.
28
+
29
+ ## 3.0.26
30
+
31
+ ### Removed
32
+
33
+ - [56ec42ae](https://github.com/appsignal/appsignal-ruby/commit/56ec42ae634c5675b1769963688a8f3f22715e0e) patch - Remove Moped support as it is no longer the official Ruby Mongo driver and it's been unmaintained for 7 years.
34
+
35
+ ### Fixed
36
+
37
+ - [991ca18d](https://github.com/appsignal/appsignal-ruby/commit/991ca18dfc5b05cf34841f84c17d821a17bf7a84) patch - Fix runtime errors on YAML load with older psych versions (`< 4`) used in combination with newer Ruby version (`3.x`).
38
+
3
39
  ## 3.0.25
4
40
 
5
41
  ### Added
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require "bundler"
2
2
  require "rubygems/package_task"
3
3
  require "fileutils"
4
+ require "yaml"
4
5
 
5
6
  VERSION_MANAGERS = {
6
7
  :chruby => {
@@ -60,7 +61,7 @@ namespace :build_matrix do
60
61
  t["dependencies"] = ["Ruby #{ruby_version}"]
61
62
  end
62
63
  gemset_for_ruby(ruby, matrix).each do |gem|
63
- next if excluded_for_ruby?(gem, ruby)
64
+ next unless included_for_ruby?(matrix, gem, ruby)
64
65
 
65
66
  env = matrix["env_vars"] + [
66
67
  env_map("RUBY_VERSION", ruby_version),
@@ -76,11 +77,12 @@ namespace :build_matrix do
76
77
  "name" => "Ruby #{ruby_version} for #{gem["gem"]}",
77
78
  "env_vars" => env + ruby.fetch("env_vars", []),
78
79
  "commands" => [
79
- "./support/bundler_wrapper exec rake test",
80
- "./support/bundler_wrapper exec rake test:failure"
80
+ "./support/bundler_wrapper exec rake test"
81
81
  ]
82
82
  }
83
83
  if gem["gem"] == "no_dependencies"
84
+ # Only test the failure scenarios once per Ruby version
85
+ job["commands"] << "./support/bundler_wrapper exec rake test:failure"
84
86
  ruby_primary_block["task"]["jobs"] << job
85
87
  else
86
88
  ruby_secondary_block["task"]["jobs"] << job
@@ -134,7 +136,8 @@ namespace :build_matrix do
134
136
  out << "./support/bundler_wrapper exec rake extension:install"
135
137
  out << "rm -f gemfiles/*.gemfile.lock"
136
138
  gemset_for_ruby(ruby, matrix).each do |gem|
137
- next if excluded_for_ruby?(gem, ruby)
139
+ next unless included_for_ruby?(matrix, gem, ruby)
140
+
138
141
  gemfile = gem["gem"]
139
142
  out << "echo 'Bundling #{gemfile} in #{ruby_version}'"
140
143
  rubygems = gem["rubygems"] || ruby["rubygems"] || defaults["rubygems"]
@@ -175,8 +178,29 @@ namespace :build_matrix do
175
178
  end
176
179
  end
177
180
 
178
- def excluded_for_ruby?(gem, ruby)
179
- (gem.dig("exclude", "ruby") || []).include?(ruby["ruby"])
181
+ def included_for_ruby?(matrix, gem, ruby)
182
+ included_rubies = gem.dig("only", "ruby") || []
183
+ excluded_rubies = gem.dig("exclude", "ruby") || []
184
+ if included_rubies.any? && excluded_rubies.any?
185
+ raise "Both `only` and `exclude` config options for gem `#{gem["gem"]}` are configured. " \
186
+ "Only use one of the two config options."
187
+ end
188
+
189
+ if included_rubies.any?
190
+ # If this gem only runs on these specific Ruby version
191
+ included_rubies.each { |version| check_if_ruby_version_exists!(matrix, version) }
192
+ return true if included_rubies.include?(ruby["ruby"])
193
+ else
194
+ # If this gem is excluded from running on this Ruby version
195
+ excluded_rubies.each { |version| check_if_ruby_version_exists!(matrix, version) }
196
+ return true unless excluded_rubies.include?(ruby["ruby"])
197
+ end
198
+ end
199
+
200
+ def check_if_ruby_version_exists!(matrix, ruby_version)
201
+ return if matrix["ruby"].find { |ruby| ruby["ruby"] == ruby_version }
202
+
203
+ raise "Ruby version `#{ruby_version}` is not known by the build matrix."
180
204
  end
181
205
  end
182
206
 
data/build_matrix.yml CHANGED
@@ -33,7 +33,16 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
33
33
  fi
34
34
  - |
35
35
  if [ -n "$RUBY_VERSION" ]; then
36
- sem-version ruby $RUBY_VERSION
36
+ if ! (sem-version ruby "$RUBY_VERSION"); then
37
+ ruby_key="rbenv-ruby-$RUBY_VERSION"
38
+ echo "Attempting to build Ruby $RUBY_VERSION from source"
39
+ git -C "$HOME/.rbenv/plugins/ruby-build" pull
40
+ cache restore "$ruby_key"
41
+ sem-version ruby "$RUBY_VERSION"
42
+ if ! cache has_key "$ruby_key"; then
43
+ cache store "$ruby_key" "$HOME/.rbenv/versions/$RUBY_VERSION"
44
+ fi
45
+ fi
37
46
  ./support/check_versions
38
47
  else
39
48
  echo Skipping Ruby install
@@ -189,88 +198,139 @@ matrix:
189
198
  - ruby: "2.6.9"
190
199
  - ruby: "2.7.5"
191
200
  - ruby: "3.0.3"
192
- - ruby: "3.1.0"
201
+ - ruby: "3.1.1"
202
+ - ruby: "3.2.0-preview1"
193
203
  - ruby: "jruby-9.2.19.0"
194
204
  gems: "minimal"
195
205
  env_vars:
196
206
  - name: "_C_VERSION"
197
207
  value: "8"
208
+ - ruby: "jruby-9.3.6.0"
209
+ gems: "minimal"
198
210
  gems:
199
211
  - gem: "no_dependencies"
200
212
  - gem: "capistrano2"
201
213
  - gem: "capistrano3"
202
214
  - gem: "grape"
203
215
  - gem: "padrino"
216
+ - gem: "psych-3"
217
+ only:
218
+ ruby:
219
+ - "3.0.3"
220
+ - "3.1.1"
221
+ - "3.2.0-preview1"
222
+ - gem: "psych-4"
223
+ only:
224
+ ruby:
225
+ - "3.0.3"
226
+ - "3.1.1"
227
+ - "3.2.0-preview1"
204
228
  - gem: "que"
205
229
  - gem: "que_beta"
206
230
  - gem: "rails-3.2"
207
231
  bundler: "1.17.3"
208
- exclude:
232
+ only:
209
233
  ruby:
210
- - "2.6.9"
211
- - "2.7.5"
212
- - "3.0.3"
213
- - "3.1.0"
234
+ - "2.0.0-p648"
235
+ - "2.1.10"
236
+ - "2.2.10"
237
+ - "2.3.8"
238
+ - "2.4.10"
239
+ - "2.5.8"
214
240
  - gem: "rails-4.2"
215
241
  bundler: "1.17.3"
216
- exclude:
242
+ only:
217
243
  ruby:
218
- - "2.6.9"
219
- - "2.7.5"
220
- - "3.0.3"
221
- - "3.1.0"
244
+ - "2.0.0-p648"
245
+ - "2.1.10"
246
+ - "2.2.10"
247
+ - "2.3.8"
248
+ - "2.4.10"
249
+ - "2.5.8"
222
250
  - gem: "rails-5.0"
223
- exclude:
224
- ruby:
225
- - "3.0.3"
226
- - "3.1.0"
227
- - gem: "rails-5.1"
228
- exclude:
229
- ruby:
230
- - "3.0.3"
231
- - "3.1.0"
232
- - gem: "rails-5.2"
233
- exclude:
234
- ruby:
235
- - "3.0.3"
236
- - "3.1.0"
237
- - gem: "rails-6.0"
238
- exclude:
251
+ only:
239
252
  ruby:
253
+ - "2.0.0-p648"
240
254
  - "2.1.10"
241
255
  - "2.2.10"
242
256
  - "2.3.8"
243
257
  - "2.4.10"
244
- - "3.1.0"
245
- - gem: "rails-6.1"
246
- exclude:
258
+ - "2.5.8"
259
+ - "2.6.9"
260
+ - "2.7.5"
261
+ - gem: "rails-5.1"
262
+ only:
247
263
  ruby:
264
+ - "2.0.0-p648"
248
265
  - "2.1.10"
249
266
  - "2.2.10"
250
267
  - "2.3.8"
251
268
  - "2.4.10"
252
- - gem: "rails-7.0"
253
- exclude:
269
+ - "2.5.8"
270
+ - "2.6.9"
271
+ - "2.7.5"
272
+ - gem: "rails-5.2"
273
+ only:
254
274
  ruby:
275
+ - "2.0.0-p648"
255
276
  - "2.1.10"
256
277
  - "2.2.10"
257
278
  - "2.3.8"
258
279
  - "2.4.10"
259
280
  - "2.5.8"
260
281
  - "2.6.9"
282
+ - "2.7.5"
283
+ - "jruby-9.2.19.0"
284
+ - gem: "rails-6.0"
285
+ only:
286
+ ruby:
287
+ - "2.5.8"
288
+ - "2.6.9"
289
+ - "2.7.5"
290
+ - "3.0.3"
261
291
  - "jruby-9.2.19.0"
292
+ - gem: "rails-6.1"
293
+ only:
294
+ ruby:
295
+ - "2.5.8"
296
+ - "2.6.9"
297
+ - "2.7.5"
298
+ - "3.0.3"
299
+ - "3.1.1"
300
+ - "3.2.0-preview1"
301
+ - "jruby-9.2.19.0"
302
+ - "jruby-9.3.6.0"
303
+ - gem: "rails-7.0"
304
+ only:
305
+ ruby:
306
+ - "2.7.5"
307
+ - "3.0.3"
308
+ - "3.1.1"
309
+ - "3.2.0-preview1"
262
310
  - gem: "resque-1"
263
311
  bundler: "1.17.3"
264
- exclude:
312
+ only:
265
313
  ruby:
266
- - "3.0.3"
267
- - "3.1.0"
314
+ - "2.0.0-p648"
315
+ - "2.1.10"
316
+ - "2.2.10"
317
+ - "2.3.8"
318
+ - "2.4.10"
319
+ - "2.5.8"
320
+ - "2.6.9"
321
+ - "2.7.5"
268
322
  - gem: "resque-2"
269
323
  - gem: "sequel"
270
324
  - gem: "sequel-435"
271
- exclude:
325
+ only:
272
326
  ruby:
273
- - "3.0.3"
274
- - "3.1.0"
327
+ - "2.0.0-p648"
328
+ - "2.1.10"
329
+ - "2.2.10"
330
+ - "2.3.8"
331
+ - "2.4.10"
332
+ - "2.5.8"
333
+ - "2.6.9"
334
+ - "2.7.5"
275
335
  - gem: "sinatra"
276
336
  - gem: "webmachine"
data/ext/agent.yml CHANGED
@@ -3,92 +3,92 @@
3
3
  # appsignal-agent repository.
4
4
  # Modifications to this file will be overwritten with the next agent release.
5
5
  ---
6
- version: f57e6cb
6
+ version: d573c9b
7
7
  mirrors:
8
8
  - https://appsignal-agent-releases.global.ssl.fastly.net
9
9
  - https://d135dj0rjqvssy.cloudfront.net
10
10
  triples:
11
11
  x86_64-darwin:
12
12
  static:
13
- checksum: dd1ae8d7897edf3112741381226e3622e91553dede6eeae48ca07aae84ac050d
13
+ checksum: a9a86594e50f22e7f7fd93a050e334048248a6dc971015e66c26150c4a689345
14
14
  filename: appsignal-x86_64-darwin-all-static.tar.gz
15
15
  dynamic:
16
- checksum: a523a85f76bdb37ffcacbf14279c3c7fed0378fbcfd20886ab66ee7602766e72
16
+ checksum: 04a69d0b608aa0e834c96c75a3bb226e7ca252fd2c74e439fdd43bf297d6bde2
17
17
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
18
18
  universal-darwin:
19
19
  static:
20
- checksum: dd1ae8d7897edf3112741381226e3622e91553dede6eeae48ca07aae84ac050d
20
+ checksum: a9a86594e50f22e7f7fd93a050e334048248a6dc971015e66c26150c4a689345
21
21
  filename: appsignal-x86_64-darwin-all-static.tar.gz
22
22
  dynamic:
23
- checksum: a523a85f76bdb37ffcacbf14279c3c7fed0378fbcfd20886ab66ee7602766e72
23
+ checksum: 04a69d0b608aa0e834c96c75a3bb226e7ca252fd2c74e439fdd43bf297d6bde2
24
24
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
25
25
  aarch64-darwin:
26
26
  static:
27
- checksum: cd5175979ec293d0471c71de1fdd00817bea75f800603a1b87931b19471495f3
27
+ checksum: 92f7f71b685985b310a9f3693a96a5db6b9133b0af807d000b90248e097063c7
28
28
  filename: appsignal-aarch64-darwin-all-static.tar.gz
29
29
  dynamic:
30
- checksum: 77503ee5debad5f503719d5fe653f30c3b3bb6624694f48ef03352f575af97c0
30
+ checksum: ffb54af4c35dd281a4735b57d8e537b8b08e87e08841e5d344caff325948a9e8
31
31
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
32
32
  arm64-darwin:
33
33
  static:
34
- checksum: cd5175979ec293d0471c71de1fdd00817bea75f800603a1b87931b19471495f3
34
+ checksum: 92f7f71b685985b310a9f3693a96a5db6b9133b0af807d000b90248e097063c7
35
35
  filename: appsignal-aarch64-darwin-all-static.tar.gz
36
36
  dynamic:
37
- checksum: 77503ee5debad5f503719d5fe653f30c3b3bb6624694f48ef03352f575af97c0
37
+ checksum: ffb54af4c35dd281a4735b57d8e537b8b08e87e08841e5d344caff325948a9e8
38
38
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
39
39
  arm-darwin:
40
40
  static:
41
- checksum: cd5175979ec293d0471c71de1fdd00817bea75f800603a1b87931b19471495f3
41
+ checksum: 92f7f71b685985b310a9f3693a96a5db6b9133b0af807d000b90248e097063c7
42
42
  filename: appsignal-aarch64-darwin-all-static.tar.gz
43
43
  dynamic:
44
- checksum: 77503ee5debad5f503719d5fe653f30c3b3bb6624694f48ef03352f575af97c0
44
+ checksum: ffb54af4c35dd281a4735b57d8e537b8b08e87e08841e5d344caff325948a9e8
45
45
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
46
46
  aarch64-linux:
47
47
  static:
48
- checksum: ae899aba4fa260c1aa1d21cc8f2bf379a2b52596ef2979e9b9b70f0cd54872d4
48
+ checksum: 79f1e7f9c34ab36c06d5c3d676173ee7c1219af2f51dc77865897598dc01349a
49
49
  filename: appsignal-aarch64-linux-all-static.tar.gz
50
50
  dynamic:
51
- checksum: 848ab3df66cac4122133145738a380d3e4763e0bcb324cb0d7c0423741751d80
51
+ checksum: cfd8e98238e2c7cdb10c0e136c47ab8e2dacab0a14d8ccf0e4c6c14946e325f1
52
52
  filename: appsignal-aarch64-linux-all-dynamic.tar.gz
53
53
  i686-linux:
54
54
  static:
55
- checksum: 3934810379bade5096a5f055450ddd38f60c1bb2fbc05bebcea92f8f7250a81e
55
+ checksum: 835c6f823a2c6e9f8fa12704bf0953e3610dc9836355b57d2d6981e6ae412fb4
56
56
  filename: appsignal-i686-linux-all-static.tar.gz
57
57
  dynamic:
58
- checksum: 2bd5207d0930f9ce262adcb955582c2a022de8872022a0ddd1ea15391339eb55
58
+ checksum: febc5d80a7b0fd9644e2d68d068d28c66359bbef9473f01e9f71fb07fd73bcb8
59
59
  filename: appsignal-i686-linux-all-dynamic.tar.gz
60
60
  x86-linux:
61
61
  static:
62
- checksum: 3934810379bade5096a5f055450ddd38f60c1bb2fbc05bebcea92f8f7250a81e
62
+ checksum: 835c6f823a2c6e9f8fa12704bf0953e3610dc9836355b57d2d6981e6ae412fb4
63
63
  filename: appsignal-i686-linux-all-static.tar.gz
64
64
  dynamic:
65
- checksum: 2bd5207d0930f9ce262adcb955582c2a022de8872022a0ddd1ea15391339eb55
65
+ checksum: febc5d80a7b0fd9644e2d68d068d28c66359bbef9473f01e9f71fb07fd73bcb8
66
66
  filename: appsignal-i686-linux-all-dynamic.tar.gz
67
67
  x86_64-linux:
68
68
  static:
69
- checksum: 956288a49717ea61ec303ef4ab52e7bfafea6e575a8bb9839df24b947d22d988
69
+ checksum: 6eb6f0df2f8c62a29769bf7f21cefaec92a24ee0ab363acc5bd4f9c2d1241c53
70
70
  filename: appsignal-x86_64-linux-all-static.tar.gz
71
71
  dynamic:
72
- checksum: abf290aa7ad7be1af54889c9dd70cf2f71902359cfc5f5ce64b53b8421914a51
72
+ checksum: ce710ff2edea2fc7b3b6bafd10af849e95f513abf5d775b9a8361ffed45b70c3
73
73
  filename: appsignal-x86_64-linux-all-dynamic.tar.gz
74
74
  x86_64-linux-musl:
75
75
  static:
76
- checksum: 5f96744692b6b079bd2b97ac6d8d5900123f108a27237664c88a49782b7ba433
76
+ checksum: b16d46074527da5700e10e5a8b176aeb46b7bbb19431653029eda04437bef918
77
77
  filename: appsignal-x86_64-linux-musl-all-static.tar.gz
78
78
  dynamic:
79
- checksum: c0a06de99d88a2e045b60d53319e1bbb8633127667fbe9f09e52f2bbaf6fb54d
79
+ checksum: 261b79ab790e6a12a748d4649a4389e96d5cf7d1f981c3b56ed331f164d1627b
80
80
  filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
81
81
  x86_64-freebsd:
82
82
  static:
83
- checksum: 23ea3fdcc5ae7dfdc85214c872ef928ed702c029b05c059db614583f689b9304
83
+ checksum: e7bfc1dc355ce1237aaee6fdf967c78ecca533db41b09c2b10716e7f8593dbe0
84
84
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
85
85
  dynamic:
86
- checksum: 683cc20296ef05257c4209b3c5d86ef32b76be6ea75a1d1ec76db0163e729a38
86
+ checksum: 97af9419cf00e22ea544a2365785a6b5df2a990f17e7735b3bbec1a690b68f0b
87
87
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
88
88
  amd64-freebsd:
89
89
  static:
90
- checksum: 23ea3fdcc5ae7dfdc85214c872ef928ed702c029b05c059db614583f689b9304
90
+ checksum: e7bfc1dc355ce1237aaee6fdf967c78ecca533db41b09c2b10716e7f8593dbe0
91
91
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
92
92
  dynamic:
93
- checksum: 683cc20296ef05257c4209b3c5d86ef32b76be6ea75a1d1ec76db0163e729a38
93
+ checksum: 97af9419cf00e22ea544a2365785a6b5df2a990f17e7735b3bbec1a690b68f0b
94
94
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'grape', '0.14.0'
3
+ gem 'grape'
4
4
  gem 'activesupport', '~> 4.2'
5
5
 
6
6
  gemspec :path => '../'
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "psych", "~> 3.3"
4
+
5
+ gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "psych", "~> 4.0"
4
+
5
+ gemspec :path => "../"
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'sequel', '< 4.35'
3
+ gem 'sequel'
4
4
  if RUBY_PLATFORM == "java"
5
5
  gem 'jdbc-sqlite3'
6
6
  else
@@ -376,7 +376,7 @@ module Appsignal
376
376
  def load_from_disk
377
377
  return if !config_file || !File.exist?(config_file)
378
378
 
379
- read_options = RUBY_VERSION >= "3.1.0" ? { :aliases => true } : {}
379
+ read_options = YAML::VERSION >= "4.0.0" ? { :aliases => true } : {}
380
380
  configurations = YAML.load(ERB.new(IO.read(config_file)).result, **read_options)
381
381
  config_for_this_env = configurations[env]
382
382
  if config_for_this_env
@@ -83,7 +83,7 @@ module Appsignal
83
83
 
84
84
  # Transaction methods
85
85
  attach_function :appsignal_free_transaction,
86
- [],
86
+ [:pointer],
87
87
  :void
88
88
  attach_function :appsignal_start_transaction,
89
89
  [:appsignal_string, :appsignal_string, :long],
@@ -191,7 +191,7 @@ module Appsignal
191
191
  :void
192
192
 
193
193
  # Data struct methods
194
- attach_function :appsignal_free_data, [], :void
194
+ attach_function :appsignal_free_data, [:pointer], :void
195
195
  attach_function :appsignal_data_map_new, [], :pointer
196
196
  attach_function :appsignal_data_array_new, [], :pointer
197
197
  attach_function :appsignal_data_map_set_string,
@@ -178,7 +178,7 @@ module Appsignal
178
178
  #
179
179
  # @example Add more metadata to transaction
180
180
  # Appsignal.send_error(e) do |transaction|
181
- # transaction.params(:search_query => params[:search_query])
181
+ # transaction.params = { :search_query => params[:search_query] }
182
182
  # transaction.set_action("my_action_name")
183
183
  # transaction.set_tags(:key => "value")
184
184
  # transaction.set_namespace("my_namespace")
@@ -258,7 +258,7 @@ module Appsignal
258
258
  # begin
259
259
  # raise "oh no!"
260
260
  # rescue => e
261
- # Appsignal.set_error(error)
261
+ # Appsignal.set_error(e)
262
262
  # end
263
263
  # # Manually completing the transaction here.
264
264
  # # Manually stopping AppSignal here
@@ -275,7 +275,7 @@ module Appsignal
275
275
  #
276
276
  # @example Add more metadata to transaction
277
277
  # Appsignal.set_error(e) do |transaction|
278
- # transaction.params(:search_query => params[:search_query])
278
+ # transaction.params = { :search_query => params[:search_query] }
279
279
  # transaction.set_action("my_action_name")
280
280
  # transaction.set_tags(:key => "value")
281
281
  # transaction.set_namespace("my_namespace")
@@ -5,7 +5,7 @@ namespace :appsignal do
5
5
  revision = fetch(:appsignal_revision, fetch(:current_revision))
6
6
 
7
7
  appsignal_config = Appsignal::Config.new(
8
- ENV["PWD"],
8
+ Dir.pwd,
9
9
  appsignal_env,
10
10
  {},
11
11
  Logger.new(StringIO.new)
@@ -158,7 +158,7 @@ module Appsignal
158
158
 
159
159
  # Based on: https://github.com/mperham/sidekiq/blob/63ee43353bd3b753beb0233f64865e658abeb1c3/lib/sidekiq/api.rb#L403-L412
160
160
  def safe_load(content, default)
161
- if RUBY_VERSION >= "3.1.0"
161
+ if YAML::VERSION >= "4.0.0"
162
162
  yield(*YAML.unsafe_load(content))
163
163
  else
164
164
  yield(*YAML.load(content))
@@ -0,0 +1,29 @@
1
+ module Appsignal
2
+ module Probes
3
+ module Helpers
4
+ private
5
+
6
+ def gauge_delta_cache
7
+ @gauge_delta_cache ||= {}
8
+ end
9
+
10
+ # Calculate the delta of two values for a gauge metric
11
+ #
12
+ # First call will store the data for the metric in the cache and the
13
+ # second call will return the delta of the gauge metric. This is used for
14
+ # absolute counter values which we want to track as gauges.
15
+ #
16
+ # @example
17
+ # gauge_delta :my_cache_key, 10
18
+ # gauge_delta :my_cache_key, 15
19
+ # # Returns a value of `5`
20
+ def gauge_delta(cache_key, value)
21
+ previous_value = gauge_delta_cache[cache_key]
22
+ gauge_delta_cache[cache_key] = value
23
+ return unless previous_value
24
+
25
+ value - previous_value
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,25 +1,66 @@
1
1
  module Appsignal
2
2
  module Probes
3
3
  class MriProbe
4
+ include Helpers
5
+
4
6
  # @api private
5
7
  def self.dependencies_present?
6
8
  defined?(::RubyVM) && ::RubyVM.respond_to?(:stat)
7
9
  end
8
10
 
9
- def initialize
11
+ def self.garbage_collection_profiler
12
+ @garbage_collection_profiler ||= Appsignal::GarbageCollectionProfiler.new
13
+ end
14
+
15
+ def initialize(appsignal = Appsignal)
10
16
  Appsignal.logger.debug("Initializing VM probe")
17
+ @appsignal = appsignal
11
18
  end
12
19
 
13
20
  # @api private
14
21
  def call
15
22
  stat = RubyVM.stat
16
- [:class_serial, :global_constant_state].each do |metric|
17
- Appsignal.add_distribution_value(
18
- "ruby_vm",
19
- stat[metric],
20
- :metric => metric
23
+
24
+ @appsignal.add_distribution_value(
25
+ "ruby_vm",
26
+ stat[:class_serial],
27
+ :metric => :class_serial
28
+ )
29
+
30
+ @appsignal.add_distribution_value(
31
+ "ruby_vm",
32
+ stat[:constant_cache] ? stat[:constant_cache].values.sum : stat[:global_constant_state],
33
+ :metric => :global_constant_state
34
+ )
35
+
36
+ @appsignal.set_gauge("thread_count", Thread.list.size)
37
+ @appsignal.set_gauge("gc_total_time", MriProbe.garbage_collection_profiler.total_time)
38
+
39
+ gc_stats = GC.stat
40
+ allocated_objects =
41
+ gauge_delta(
42
+ :allocated_objects,
43
+ gc_stats[:total_allocated_objects] || gc_stats[:total_allocated_object]
21
44
  )
45
+ if allocated_objects
46
+ @appsignal.set_gauge("allocated_objects", allocated_objects)
47
+ end
48
+
49
+ gc_count = gauge_delta(:gc_count, GC.count)
50
+ if gc_count
51
+ @appsignal.add_distribution_value("gc_count", gc_count, :metric => :gc_count)
22
52
  end
53
+ minor_gc_count = gauge_delta(:minor_gc_count, gc_stats[:minor_gc_count])
54
+ if minor_gc_count
55
+ @appsignal.add_distribution_value("gc_count", minor_gc_count, :metric => :minor_gc_count)
56
+ end
57
+ major_gc_count = gauge_delta(:major_gc_count, gc_stats[:major_gc_count])
58
+ if major_gc_count
59
+ @appsignal.add_distribution_value("gc_count", major_gc_count, :metric => :major_gc_count)
60
+ end
61
+
62
+ @appsignal.add_distribution_value("heap_slots", gc_stats[:heap_live_slots] || gc_stats[:heap_live_slot], :metric => :heap_live)
63
+ @appsignal.add_distribution_value("heap_slots", gc_stats[:heap_free_slots] || gc_stats[:heap_free_slot], :metric => :heap_free)
23
64
  end
24
65
  end
25
66
  end