appsignal 0.12.beta.5 → 0.12.beta.6

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/.gitignore CHANGED
@@ -23,6 +23,7 @@ bundle_and_spec_all_rbenv.sh
23
23
  bundle_and_spec_all_rvm.sh
24
24
  ext/libappsignal.*
25
25
  ext/appsignal-agent
26
+ ext/appsignal_extension.h
26
27
  ext/Makefile
27
28
  ext/*.bundle
28
29
  ext/*.o
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  * Use native library and agent
4
4
  * Use API V2
5
5
 
6
+ # 0.11.11
7
+ * Reliably get errors in production for Sinatra
8
+
6
9
  # 0.11.10
7
10
  * Fix for binding bug in exceptions in Resque
8
11
  * Handle invalidly encoded characters in payload
@@ -1,25 +1,5 @@
1
1
  #include<ruby.h>
2
-
3
- void appsignal_start(void);
4
- void appsignal_stop(void);
5
- void appsignal_start_transaction(char *);
6
- void appsignal_start_event(char *);
7
- void appsignal_finish_event(char *, char *, char *, char *);
8
- void appsignal_set_transaction_error(char *, char *, char *);
9
- void appsignal_set_transaction_error_data(char *, char *, char *);
10
- void appsignal_set_transaction_basedata(char *, char *, char *, long);
11
- void appsignal_set_transaction_metadata(char *, char *, char *);
12
- void appsignal_finish_transaction(char *);
13
- void appsignal_set_gauge(char *, float);
14
- void appsignal_set_process_gauge(char *, float);
15
- void appsignal_increment_counter(char *, int);
16
- void appsignal_add_distribution_value(char *, float);
17
-
18
- static char * STRING_POINTER(VALUE str) {
19
- // TODO we should use RSTRING_PTR and RSTRING_LEN, see:
20
- // https://github.com/ruby/ruby/blob/trunk/doc/extension.rdoc
21
- return StringValueCStr(str);
22
- }
2
+ #include<appsignal_extension.h>
23
3
 
24
4
  static VALUE start(VALUE self) {
25
5
  appsignal_start();
@@ -36,14 +16,14 @@ static VALUE stop(VALUE self) {
36
16
  static VALUE start_transaction(VALUE self, VALUE transaction_id) {
37
17
  Check_Type(transaction_id, T_STRING);
38
18
 
39
- appsignal_start_transaction(STRING_POINTER(transaction_id));
19
+ appsignal_start_transaction(StringValueCStr(transaction_id));
40
20
  return Qnil;
41
21
  }
42
22
 
43
23
  static VALUE start_event(VALUE self, VALUE transaction_id) {
44
24
  Check_Type(transaction_id, T_STRING);
45
25
 
46
- appsignal_start_event(STRING_POINTER(transaction_id));
26
+ appsignal_start_event(StringValueCStr(transaction_id));
47
27
  return Qnil;
48
28
  }
49
29
 
@@ -54,10 +34,10 @@ static VALUE finish_event(VALUE self, VALUE transaction_id, VALUE name, VALUE ti
54
34
  Check_Type(body, T_STRING);
55
35
 
56
36
  appsignal_finish_event(
57
- STRING_POINTER(transaction_id),
58
- STRING_POINTER(name),
59
- STRING_POINTER(title),
60
- STRING_POINTER(body)
37
+ StringValueCStr(transaction_id),
38
+ StringValueCStr(name),
39
+ StringValueCStr(title),
40
+ StringValueCStr(body)
61
41
  );
62
42
  return Qnil;
63
43
  }
@@ -68,9 +48,9 @@ static VALUE set_transaction_error(VALUE self, VALUE transaction_id, VALUE name,
68
48
  Check_Type(message, T_STRING);
69
49
 
70
50
  appsignal_set_transaction_error(
71
- STRING_POINTER(transaction_id),
72
- STRING_POINTER(name),
73
- STRING_POINTER(message)
51
+ StringValueCStr(transaction_id),
52
+ StringValueCStr(name),
53
+ StringValueCStr(message)
74
54
  );
75
55
  return Qnil;
76
56
  }
@@ -81,9 +61,9 @@ static VALUE set_transaction_error_data(VALUE self, VALUE transaction_id, VALUE
81
61
  Check_Type(payload, T_STRING);
82
62
 
83
63
  appsignal_set_transaction_error_data(
84
- STRING_POINTER(transaction_id),
85
- STRING_POINTER(key),
86
- STRING_POINTER(payload)
64
+ StringValueCStr(transaction_id),
65
+ StringValueCStr(key),
66
+ StringValueCStr(payload)
87
67
  );
88
68
  return Qnil;
89
69
  }
@@ -95,9 +75,9 @@ static VALUE set_transaction_basedata(VALUE self, VALUE transaction_id, VALUE na
95
75
  Check_Type(queue_start, T_FIXNUM);
96
76
 
97
77
  appsignal_set_transaction_basedata(
98
- STRING_POINTER(transaction_id),
99
- STRING_POINTER(namespace),
100
- STRING_POINTER(action),
78
+ StringValueCStr(transaction_id),
79
+ StringValueCStr(namespace),
80
+ StringValueCStr(action),
101
81
  FIX2LONG(queue_start)
102
82
  );
103
83
  return Qnil;
@@ -109,9 +89,9 @@ static VALUE set_transaction_metadata(VALUE self, VALUE transaction_id, VALUE ke
109
89
  Check_Type(value, T_STRING);
110
90
 
111
91
  appsignal_set_transaction_metadata(
112
- STRING_POINTER(transaction_id),
113
- STRING_POINTER(key),
114
- STRING_POINTER(value)
92
+ StringValueCStr(transaction_id),
93
+ StringValueCStr(key),
94
+ StringValueCStr(value)
115
95
  );
116
96
  return Qnil;
117
97
  }
@@ -119,7 +99,7 @@ static VALUE set_transaction_metadata(VALUE self, VALUE transaction_id, VALUE ke
119
99
  static VALUE finish_transaction(VALUE self, VALUE transaction_id) {
120
100
  Check_Type(transaction_id, T_STRING);
121
101
 
122
- appsignal_finish_transaction(STRING_POINTER(transaction_id));
102
+ appsignal_finish_transaction(StringValueCStr(transaction_id));
123
103
  return Qnil;
124
104
  }
125
105
 
@@ -128,7 +108,18 @@ static VALUE set_gauge(VALUE self, VALUE key, VALUE value) {
128
108
  Check_Type(value, T_FLOAT);
129
109
 
130
110
  appsignal_set_gauge(
131
- STRING_POINTER(key),
111
+ StringValueCStr(key),
112
+ NUM2DBL(value)
113
+ );
114
+ return Qnil;
115
+ }
116
+
117
+ static VALUE set_host_gauge(VALUE self, VALUE key, VALUE value) {
118
+ Check_Type(key, T_STRING);
119
+ Check_Type(value, T_FLOAT);
120
+
121
+ appsignal_set_host_gauge(
122
+ StringValueCStr(key),
132
123
  NUM2DBL(value)
133
124
  );
134
125
  return Qnil;
@@ -139,7 +130,7 @@ static VALUE set_process_gauge(VALUE self, VALUE key, VALUE value) {
139
130
  Check_Type(value, T_FLOAT);
140
131
 
141
132
  appsignal_set_process_gauge(
142
- STRING_POINTER(key),
133
+ StringValueCStr(key),
143
134
  NUM2DBL(value)
144
135
  );
145
136
  return Qnil;
@@ -150,7 +141,7 @@ static VALUE increment_counter(VALUE self, VALUE key, VALUE count) {
150
141
  Check_Type(count, T_FIXNUM);
151
142
 
152
143
  appsignal_increment_counter(
153
- STRING_POINTER(key),
144
+ StringValueCStr(key),
154
145
  FIX2INT(count)
155
146
  );
156
147
  return Qnil;
@@ -161,7 +152,7 @@ static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value) {
161
152
  Check_Type(value, T_FLOAT);
162
153
 
163
154
  appsignal_add_distribution_value(
164
- STRING_POINTER(key),
155
+ StringValueCStr(key),
165
156
  NUM2DBL(value)
166
157
  );
167
158
  return Qnil;
@@ -185,6 +176,7 @@ void Init_appsignal_extension(void) {
185
176
 
186
177
  // Metrics
187
178
  rb_define_singleton_method(Extension, "set_gauge", set_gauge, 2);
179
+ rb_define_singleton_method(Extension, "set_host_gauge", set_host_gauge, 2);
188
180
  rb_define_singleton_method(Extension, "set_process_gauge", set_process_gauge, 2);
189
181
  rb_define_singleton_method(Extension, "increment_counter", increment_counter, 2);
190
182
  rb_define_singleton_method(Extension, "add_distribution_value", add_distribution_value, 2);
data/lib/appsignal.rb CHANGED
@@ -117,6 +117,10 @@ module Appsignal
117
117
  Appsignal::Extension.set_gauge(key, value)
118
118
  end
119
119
 
120
+ def set_host_gauge(key, value)
121
+ Appsignal::Extension.set_host_gauge(key, value)
122
+ end
123
+
120
124
  def set_process_gauge(key, value)
121
125
  Appsignal::Extension.set_process_gauge(key, value)
122
126
  end
@@ -21,6 +21,10 @@ module Appsignal
21
21
  payload[:action] = env['sinatra.route']
22
22
  end
23
23
  end
24
+ ensure
25
+ # In production newer versions of Sinatra don't raise errors, but store
26
+ # them in the sinatra.error env var.
27
+ Appsignal::Transaction.current.add_exception(env['sinatra.error']) if env['sinatra.error']
24
28
  end
25
29
 
26
30
  def raw_payload(env)
@@ -95,6 +95,7 @@ module Appsignal
95
95
 
96
96
  def set_error(error)
97
97
  return unless error
98
+ Appsignal.logger.debug("Adding #{error.class.name} to transaction: #{request_id}")
98
99
  Appsignal::Extension.set_transaction_error(
99
100
  request_id,
100
101
  error.class.name,
@@ -1,4 +1,4 @@
1
1
  module Appsignal
2
- VERSION = '0.12.beta.5'
3
- AGENT_VERSION = '5399e29'
2
+ VERSION = '0.12.beta.6'
3
+ AGENT_VERSION = 'fc00f64'
4
4
  end
@@ -49,6 +49,19 @@ if defined?(::Sinatra)
49
49
  process_action_event.name.should == 'process_action.sinatra'
50
50
  process_action_event.payload[:action].should == 'GET /'
51
51
  end
52
+
53
+ it "should add exceptions stored in env under sinatra.error" do
54
+ exception = RuntimeError.new('Raise the roof')
55
+ env['sinatra.error'] = exception
56
+
57
+ transaction = double
58
+ transaction.stub(:set_process_action_event)
59
+ transaction.stub(:add_event)
60
+ transaction.should_receive(:add_exception).with(exception)
61
+ Appsignal::Transaction.stub(:current => transaction)
62
+
63
+ middleware.call(env)
64
+ end
52
65
  end
53
66
 
54
67
  describe "raw_payload" do
@@ -300,6 +300,13 @@ describe Appsignal do
300
300
  end
301
301
  end
302
302
 
303
+ describe ".set_host_gauge" do
304
+ it "should call set_host_gauge on the extension" do
305
+ Appsignal::Extension.should_receive(:set_host_gauge).with('key', 0.1)
306
+ Appsignal.set_host_gauge('key', 0.1)
307
+ end
308
+ end
309
+
303
310
  describe ".set_process_gauge" do
304
311
  it "should call set_process_gauge on the extension" do
305
312
  Appsignal::Extension.should_receive(:set_process_gauge).with('key', 0.1)
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.beta.5
4
+ version: 0.12.beta.6
5
+ prerelease: 5
5
6
  platform: ruby
6
7
  authors:
7
8
  - Robert Beekman
@@ -12,104 +13,118 @@ authors:
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2015-06-12 00:00:00.000000000 Z
16
+ date: 2015-06-18 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: rack
19
20
  requirement: !ruby/object:Gem::Requirement
21
+ none: false
20
22
  requirements:
21
- - - ">="
23
+ - - ! '>='
22
24
  - !ruby/object:Gem::Version
23
25
  version: '0'
24
26
  type: :runtime
25
27
  prerelease: false
26
28
  version_requirements: !ruby/object:Gem::Requirement
29
+ none: false
27
30
  requirements:
28
- - - ">="
31
+ - - ! '>='
29
32
  - !ruby/object:Gem::Version
30
33
  version: '0'
31
34
  - !ruby/object:Gem::Dependency
32
35
  name: thread_safe
33
36
  requirement: !ruby/object:Gem::Requirement
37
+ none: false
34
38
  requirements:
35
- - - ">="
39
+ - - ! '>='
36
40
  - !ruby/object:Gem::Version
37
41
  version: '0'
38
42
  type: :runtime
39
43
  prerelease: false
40
44
  version_requirements: !ruby/object:Gem::Requirement
45
+ none: false
41
46
  requirements:
42
- - - ">="
47
+ - - ! '>='
43
48
  - !ruby/object:Gem::Version
44
49
  version: '0'
45
50
  - !ruby/object:Gem::Dependency
46
51
  name: rake
47
52
  requirement: !ruby/object:Gem::Requirement
53
+ none: false
48
54
  requirements:
49
- - - ">="
55
+ - - ! '>='
50
56
  - !ruby/object:Gem::Version
51
57
  version: '0'
52
58
  type: :development
53
59
  prerelease: false
54
60
  version_requirements: !ruby/object:Gem::Requirement
61
+ none: false
55
62
  requirements:
56
- - - ">="
63
+ - - ! '>='
57
64
  - !ruby/object:Gem::Version
58
65
  version: '0'
59
66
  - !ruby/object:Gem::Dependency
60
67
  name: rspec
61
68
  requirement: !ruby/object:Gem::Requirement
69
+ none: false
62
70
  requirements:
63
- - - "~>"
71
+ - - ~>
64
72
  - !ruby/object:Gem::Version
65
73
  version: 2.14.1
66
74
  type: :development
67
75
  prerelease: false
68
76
  version_requirements: !ruby/object:Gem::Requirement
77
+ none: false
69
78
  requirements:
70
- - - "~>"
79
+ - - ~>
71
80
  - !ruby/object:Gem::Version
72
81
  version: 2.14.1
73
82
  - !ruby/object:Gem::Dependency
74
83
  name: pry
75
84
  requirement: !ruby/object:Gem::Requirement
85
+ none: false
76
86
  requirements:
77
- - - ">="
87
+ - - ! '>='
78
88
  - !ruby/object:Gem::Version
79
89
  version: '0'
80
90
  type: :development
81
91
  prerelease: false
82
92
  version_requirements: !ruby/object:Gem::Requirement
93
+ none: false
83
94
  requirements:
84
- - - ">="
95
+ - - ! '>='
85
96
  - !ruby/object:Gem::Version
86
97
  version: '0'
87
98
  - !ruby/object:Gem::Dependency
88
99
  name: timecop
89
100
  requirement: !ruby/object:Gem::Requirement
101
+ none: false
90
102
  requirements:
91
- - - ">="
103
+ - - ! '>='
92
104
  - !ruby/object:Gem::Version
93
105
  version: '0'
94
106
  type: :development
95
107
  prerelease: false
96
108
  version_requirements: !ruby/object:Gem::Requirement
109
+ none: false
97
110
  requirements:
98
- - - ">="
111
+ - - ! '>='
99
112
  - !ruby/object:Gem::Version
100
113
  version: '0'
101
114
  - !ruby/object:Gem::Dependency
102
115
  name: webmock
103
116
  requirement: !ruby/object:Gem::Requirement
117
+ none: false
104
118
  requirements:
105
- - - ">="
119
+ - - ! '>='
106
120
  - !ruby/object:Gem::Version
107
121
  version: '0'
108
122
  type: :development
109
123
  prerelease: false
110
124
  version_requirements: !ruby/object:Gem::Requirement
125
+ none: false
111
126
  requirements:
112
- - - ">="
127
+ - - ! '>='
113
128
  - !ruby/object:Gem::Version
114
129
  version: '0'
115
130
  description: The official appsignal.com gem
@@ -121,9 +136,9 @@ extensions:
121
136
  - ext/extconf.rb
122
137
  extra_rdoc_files: []
123
138
  files:
124
- - ".gitignore"
125
- - ".rspec"
126
- - ".travis.yml"
139
+ - .gitignore
140
+ - .rspec
141
+ - .travis.yml
127
142
  - CHANGELOG.md
128
143
  - Gemfile
129
144
  - LICENSE
@@ -231,27 +246,28 @@ files:
231
246
  homepage: https://github.com/appsignal/appsignal
232
247
  licenses:
233
248
  - MIT
234
- metadata: {}
235
249
  post_install_message:
236
250
  rdoc_options: []
237
251
  require_paths:
238
252
  - lib
239
253
  - ext
240
254
  required_ruby_version: !ruby/object:Gem::Requirement
255
+ none: false
241
256
  requirements:
242
- - - ">="
257
+ - - ! '>='
243
258
  - !ruby/object:Gem::Version
244
259
  version: '1.9'
245
260
  required_rubygems_version: !ruby/object:Gem::Requirement
261
+ none: false
246
262
  requirements:
247
- - - ">"
263
+ - - ! '>'
248
264
  - !ruby/object:Gem::Version
249
265
  version: 1.3.1
250
266
  requirements: []
251
267
  rubyforge_project:
252
- rubygems_version: 2.4.5
268
+ rubygems_version: 1.8.23
253
269
  signing_key:
254
- specification_version: 4
270
+ specification_version: 3
255
271
  summary: Logs performance and exception data from your app to appsignal.com
256
272
  test_files:
257
273
  - spec/lib/appsignal/auth_check_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 271bcbb77742ccadac194841ea60e95de1342441
4
- data.tar.gz: bf94b02a25609bcecd4eea352371df9120253ad5
5
- SHA512:
6
- metadata.gz: 15b3ed0a890e045bbfce51c6e916c99e5dc6aa2d6e41f3111fa741896ae728e5761e55c08a5de67fe1a4f548fe0b0d38153cfbfd4310fec5a014100ae335b461
7
- data.tar.gz: bb81572c79a901e99f535ea9164082a1575bf5b13057f00b04ce5ad4bbdebd519a81764ddad8472926d8a9f25623e9da13267d52898779b82194170af76356d2