appsignal 0.12.beta.11 → 0.12.beta.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef0ea697d3dfdb8716ba8ae2ad3d5c725479f7c8
4
- data.tar.gz: 191f9cb7145cbdab4ae796fa6422386f35e78fec
3
+ metadata.gz: f3689f828f3bf36b1611e6c48735d8ded959018d
4
+ data.tar.gz: 6891cb3f1b689a1b0546403b0c2e4d54f537703a
5
5
  SHA512:
6
- metadata.gz: b2423a2ff6db6b32f1e8f90b2c540cae167ca8b7b4748e8ffb8133e637a9c21f3cffa3242ec4c4ab07cb84956e59e25c562edac9cec2d65c91adbd2396ea8d1a
7
- data.tar.gz: a3e2e347e9a1fb185445be257c7efa9a484879d0a5ac28d8207c7ab335618b0ed0637a2c1fc3d48283dec2d9a9f15da5cfc84ab7df9ddab3f5bea1e445f801b0
6
+ metadata.gz: c5b294da4d1c3d2f91f99fa2c3a7cffd8682f0a392475456c6e9607345d94d0ae0ffa10c9f421572695a8e9e8552035687ecb1269493d5cb24f3d9048b3de2ae
7
+ data.tar.gz: c786a62377f1e1346ea12cad1785fd74ba3c5483060cba18815d4874c7206a40bc54689fd336a3a1e219908892d6269cc952cb80a6404ba9c6cb769d76b3e66e
@@ -1,5 +1,4 @@
1
1
  #include "ruby/ruby.h"
2
- #include "ruby/debug.h"
3
2
  #include "appsignal_extension.h"
4
3
 
5
4
  static VALUE start(VALUE self) {
@@ -158,41 +157,49 @@ static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value) {
158
157
  return Qnil;
159
158
  }
160
159
 
161
- static void track_allocation(VALUE tpval, void *data) {
160
+ static void track_allocation(rb_event_flag_t flag, VALUE arg1, VALUE arg2, ID arg3, VALUE arg4) {
162
161
  appsignal_track_allocation();
163
162
  }
164
163
 
165
- static void track_gc(VALUE tpval, void *data) {
166
- rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval);
167
- rb_event_flag_t flag = rb_tracearg_event_flag(tparg);
164
+ static void track_gc_start(rb_event_flag_t flag, VALUE arg1, VALUE arg2, ID arg3, VALUE arg4) {
165
+ appsignal_track_gc_start();
166
+ }
168
167
 
169
- switch (flag) {
170
- case RUBY_INTERNAL_EVENT_GC_START:
171
- appsignal_track_gc_start();
172
- case RUBY_INTERNAL_EVENT_GC_END_SWEEP:
173
- appsignal_track_gc_end();
174
- }
168
+ static void track_gc_end(rb_event_flag_t flag, VALUE arg1, VALUE arg2, ID arg3, VALUE arg4) {
169
+ appsignal_track_gc_end();
175
170
  }
176
171
 
177
- static void install_tracepoint_callbacks() {
172
+ static void install_event_hooks() {
173
+ // These event hooks are only available on Ruby 2.1 and 2.2
178
174
  #if defined(RUBY_INTERNAL_EVENT_NEWOBJ)
179
- VALUE allocation_tracer = rb_tracepoint_new(
180
- Qnil,
181
- RUBY_INTERNAL_EVENT_NEWOBJ,
175
+ rb_add_event_hook(
182
176
  track_allocation,
183
- 0
177
+ RUBY_INTERNAL_EVENT_NEWOBJ,
178
+ Qnil
179
+ );
180
+ #endif
181
+ #if defined(RUBY_INTERNAL_EVENT_GC_START)
182
+ rb_add_event_hook(
183
+ track_gc_start,
184
+ RUBY_INTERNAL_EVENT_GC_START,
185
+ Qnil
186
+ );
187
+ #endif
188
+ #if defined(RUBY_INTERNAL_EVENT_GC_END_SWEEP)
189
+ // Ruby 2.1
190
+ rb_add_event_hook(
191
+ track_gc_end,
192
+ RUBY_INTERNAL_EVENT_GC_END_SWEEP,
193
+ Qnil
184
194
  );
185
- rb_tracepoint_enable(allocation_tracer);
186
195
  #endif
187
- #if defined(RUBY_INTERNAL_EVENT_GC_START) && defined(RUBY_INTERNAL_EVENT_GC_END_SWEEP)
188
- rb_event_flag_t events = RUBY_INTERNAL_EVENT_GC_START|RUBY_INTERNAL_EVENT_GC_END_SWEEP;
189
- VALUE gc_tracer = rb_tracepoint_new(
190
- Qnil,
191
- events,
192
- track_gc,
193
- 0
196
+ #if defined(RUBY_INTERNAL_EVENT_GC_END)
197
+ // Ruby 2.2
198
+ rb_add_event_hook(
199
+ track_gc_end,
200
+ RUBY_INTERNAL_EVENT_GC_END,
201
+ Qnil
194
202
  );
195
- rb_tracepoint_enable(gc_tracer);
196
203
  #endif
197
204
  }
198
205
 
@@ -208,7 +215,7 @@ void Init_appsignal_extension(void) {
208
215
  rb_define_singleton_method(Extension, "finish_event", finish_event, 4);
209
216
  rb_define_singleton_method(Extension, "set_transaction_error", set_transaction_error, 3);
210
217
  rb_define_singleton_method(Extension, "set_transaction_error_data", set_transaction_error_data, 3);
211
- rb_define_singleton_method(Extension, "set_transaction_base_data", set_transaction_base_data, 4);
218
+ rb_define_singleton_method(Extension, "set_transaction_base_data", set_transaction_base_data, 4);
212
219
  rb_define_singleton_method(Extension, "set_transaction_metadata", set_transaction_metadata, 3);
213
220
  rb_define_singleton_method(Extension, "finish_transaction", finish_transaction, 1);
214
221
 
@@ -219,6 +226,6 @@ void Init_appsignal_extension(void) {
219
226
  rb_define_singleton_method(Extension, "increment_counter", increment_counter, 2);
220
227
  rb_define_singleton_method(Extension, "add_distribution_value", add_distribution_value, 2);
221
228
 
222
- // Tracepoint callbacks
223
- install_tracepoint_callbacks();
229
+ // Event hooks
230
+ install_event_hooks();
224
231
  }
@@ -1,4 +1,4 @@
1
1
  module Appsignal
2
- VERSION = '0.12.beta.11'
3
- AGENT_VERSION = 'd01f887'
2
+ VERSION = '0.12.beta.12'
3
+ AGENT_VERSION = 'ffa51a6'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.beta.11
4
+ version: 0.12.beta.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman