appsignal 0.12.beta.7 → 0.12.beta.8

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.
@@ -1,5 +1,8 @@
1
- #include<ruby.h>
2
- #include<appsignal_extension.h>
1
+ #include "ruby/ruby.h"
2
+ #include "ruby/debug.h"
3
+ #include "appsignal_extension.h"
4
+
5
+ VALUE __current_transaction_id = Qnil;
3
6
 
4
7
  static VALUE start(VALUE self) {
5
8
  appsignal_start();
@@ -16,6 +19,8 @@ static VALUE stop(VALUE self) {
16
19
  static VALUE start_transaction(VALUE self, VALUE transaction_id) {
17
20
  Check_Type(transaction_id, T_STRING);
18
21
 
22
+ __current_transaction_id = transaction_id;
23
+
19
24
  appsignal_start_transaction(StringValueCStr(transaction_id));
20
25
  return Qnil;
21
26
  }
@@ -99,6 +104,8 @@ static VALUE set_transaction_metadata(VALUE self, VALUE transaction_id, VALUE ke
99
104
  static VALUE finish_transaction(VALUE self, VALUE transaction_id) {
100
105
  Check_Type(transaction_id, T_STRING);
101
106
 
107
+ __current_transaction_id = Qnil;
108
+
102
109
  appsignal_finish_transaction(StringValueCStr(transaction_id));
103
110
  return Qnil;
104
111
  }
@@ -158,6 +165,25 @@ static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value) {
158
165
  return Qnil;
159
166
  }
160
167
 
168
+ static void track_allocation(VALUE tpval, void *data) {
169
+ if (__current_transaction_id != Qnil) {
170
+ appsignal_track_allocation(StringValueCStr(__current_transaction_id));
171
+ }
172
+ }
173
+
174
+ static void install_tracepoint() {
175
+ #if defined(RUBY_INTERNAL_EVENT_NEWOBJ)
176
+ VALUE allocation_tracer;
177
+ allocation_tracer = rb_tracepoint_new(
178
+ Qnil,
179
+ RUBY_INTERNAL_EVENT_NEWOBJ,
180
+ track_allocation,
181
+ 0
182
+ );
183
+ rb_tracepoint_enable(allocation_tracer);
184
+ #endif
185
+ }
186
+
161
187
  void Init_appsignal_extension(void) {
162
188
  VALUE Appsignal = rb_define_module("Appsignal");
163
189
  VALUE Extension = rb_define_class_under(Appsignal, "Extension", rb_cObject);
@@ -180,4 +206,7 @@ void Init_appsignal_extension(void) {
180
206
  rb_define_singleton_method(Extension, "set_process_gauge", set_process_gauge, 2);
181
207
  rb_define_singleton_method(Extension, "increment_counter", increment_counter, 2);
182
208
  rb_define_singleton_method(Extension, "add_distribution_value", add_distribution_value, 2);
209
+
210
+ // Install tracepoint
211
+ install_tracepoint();
183
212
  }
@@ -1,4 +1,4 @@
1
1
  module Appsignal
2
- VERSION = '0.12.beta.7'
3
- AGENT_VERSION = 'fc00f64'
2
+ VERSION = '0.12.beta.8'
3
+ AGENT_VERSION = '561eea5'
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.7
4
+ version: 0.12.beta.8
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-06-18 00:00:00.000000000 Z
16
+ date: 2015-06-29 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rack