appsignal 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -0
- data/README.md +20 -19
- data/appsignal.gemspec +2 -2
- data/lib/appsignal.rb +41 -18
- data/lib/appsignal/agent.rb +28 -54
- data/lib/appsignal/aggregator.rb +65 -0
- data/lib/appsignal/aggregator/post_processor.rb +27 -0
- data/lib/appsignal/config.rb +9 -4
- data/lib/appsignal/listener.rb +30 -0
- data/lib/appsignal/middleware.rb +4 -30
- data/lib/appsignal/middleware/action_view_sanitizer.rb +21 -0
- data/lib/appsignal/middleware/active_record_sanitizer.rb +60 -0
- data/lib/appsignal/middleware/chain.rb +99 -0
- data/lib/appsignal/middleware/delete_blanks.rb +12 -0
- data/lib/appsignal/railtie.rb +9 -1
- data/lib/appsignal/to_appsignal_hash.rb +23 -0
- data/lib/appsignal/transaction.rb +72 -16
- data/lib/appsignal/transaction/params_sanitizer.rb +91 -13
- data/lib/appsignal/transaction/transaction_formatter.rb +32 -68
- data/lib/appsignal/version.rb +1 -1
- data/spec/appsignal/agent_spec.rb +46 -156
- data/spec/appsignal/aggregator/post_processor_spec.rb +84 -0
- data/spec/appsignal/aggregator_spec.rb +182 -0
- data/spec/appsignal/inactive_railtie_spec.rb +2 -1
- data/spec/appsignal/{middleware_spec.rb → listener_spec.rb} +2 -2
- data/spec/appsignal/middleware/action_view_sanitizer_spec.rb +27 -0
- data/spec/appsignal/middleware/active_record_sanitizer_spec.rb +201 -0
- data/spec/appsignal/middleware/chain_spec.rb +168 -0
- data/spec/appsignal/middleware/delete_blanks_spec.rb +37 -0
- data/spec/appsignal/railtie_spec.rb +47 -34
- data/spec/appsignal/to_appsignal_hash_spec.rb +29 -0
- data/spec/appsignal/transaction/params_sanitizer_spec.rb +141 -36
- data/spec/appsignal/transaction/transaction_formatter_spec.rb +60 -155
- data/spec/appsignal/transaction_spec.rb +186 -53
- data/spec/appsignal/transmitter_spec.rb +11 -6
- data/spec/appsignal_spec.rb +33 -0
- data/spec/spec_helper.rb +9 -62
- data/spec/support/helpers/notification_helpers.rb +30 -0
- data/spec/support/helpers/transaction_helpers.rb +64 -0
- metadata +74 -63
- data/.rvmrc +0 -1
- data/lib/appsignal/transaction/faulty_request_formatter.rb +0 -30
- data/lib/appsignal/transaction/regular_request_formatter.rb +0 -11
- data/lib/appsignal/transaction/slow_request_formatter.rb +0 -34
- data/spec/appsignal/transaction/faulty_request_formatter_spec.rb +0 -49
- data/spec/appsignal/transaction/regular_request_formatter_spec.rb +0 -14
- data/spec/appsignal/transaction/slow_request_formatter_spec.rb +0 -76
@@ -0,0 +1,30 @@
|
|
1
|
+
module NotificationHelpers
|
2
|
+
|
3
|
+
def notification_event(args={})
|
4
|
+
time = Time.parse('01-01-2001 10:01:00')
|
5
|
+
args = {
|
6
|
+
:name => 'process_action.action_controller',
|
7
|
+
:start => time,
|
8
|
+
:ending => time + 0.100,
|
9
|
+
:tid => '1',
|
10
|
+
:payload => create_payload
|
11
|
+
}.merge(args)
|
12
|
+
ActiveSupport::Notifications::Event.new(
|
13
|
+
args[:name], args[:start], args[:ending], args[:tid], args[:payload]
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_payload(args = {})
|
18
|
+
{
|
19
|
+
:path => '/blog',
|
20
|
+
:action => 'show',
|
21
|
+
:controller => 'BlogPostsController',
|
22
|
+
:request_format => 'html',
|
23
|
+
:request_method => "GET",
|
24
|
+
:status => '200',
|
25
|
+
:view_runtime => 500,
|
26
|
+
:db_runtime => 500
|
27
|
+
}.merge(args)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module TransactionHelpers
|
2
|
+
|
3
|
+
def transaction_with_exception
|
4
|
+
appsignal_transaction.tap do |o|
|
5
|
+
begin
|
6
|
+
raise ArgumentError, 'oh no'
|
7
|
+
rescue ArgumentError => exception
|
8
|
+
env = {}
|
9
|
+
o.add_exception(
|
10
|
+
Appsignal::ExceptionNotification.new(env, exception)
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def regular_transaction
|
17
|
+
appsignal_transaction(:process_action_event => notification_event)
|
18
|
+
end
|
19
|
+
|
20
|
+
def slow_transaction(args={})
|
21
|
+
time = Time.parse('01-01-2001 10:01:00')
|
22
|
+
appsignal_transaction(
|
23
|
+
{
|
24
|
+
:process_action_event => notification_event(
|
25
|
+
:start => time,
|
26
|
+
:ending => time + Appsignal.config[:slow_request_threshold] / 1000.0
|
27
|
+
)
|
28
|
+
}.merge(args)
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def slower_transaction(args={})
|
33
|
+
time = Time.parse('01-01-2001 10:01:00')
|
34
|
+
appsignal_transaction(
|
35
|
+
{
|
36
|
+
:process_action_event => notification_event(
|
37
|
+
:start => time,
|
38
|
+
:ending => time + Appsignal.config[:slow_request_threshold] / 500.0
|
39
|
+
)
|
40
|
+
}.merge(args)
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def appsignal_transaction(args = {})
|
45
|
+
process_action_event = args.delete(:process_action_event)
|
46
|
+
events = args.delete(:events) || [
|
47
|
+
notification_event(:name => 'query.mongoid')
|
48
|
+
]
|
49
|
+
exception = args.delete(:exception)
|
50
|
+
Appsignal::Transaction.create(
|
51
|
+
'1',
|
52
|
+
{
|
53
|
+
'HTTP_USER_AGENT' => 'IE6',
|
54
|
+
'SERVER_NAME' => 'localhost',
|
55
|
+
'action_dispatch.routes' => 'not_available'
|
56
|
+
}.merge(args)
|
57
|
+
).tap do |o|
|
58
|
+
o.set_process_action_event(process_action_event)
|
59
|
+
o.add_exception(exception)
|
60
|
+
events.each { |event| o.add_event(event) }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.4.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Robert Beekman
|
@@ -13,120 +13,120 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-04-
|
16
|
+
date: 2013-04-12 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '3'
|
24
|
-
none: false
|
25
|
-
prerelease: false
|
26
19
|
name: rails
|
27
20
|
requirement: !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
28
22
|
requirements:
|
29
23
|
- - ~>
|
30
24
|
- !ruby/object:Gem::Version
|
31
|
-
version: '3'
|
32
|
-
none: false
|
25
|
+
version: '3.0'
|
33
26
|
type: :runtime
|
34
|
-
|
27
|
+
prerelease: false
|
35
28
|
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
36
30
|
requirements:
|
37
|
-
- -
|
31
|
+
- - ~>
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
40
|
-
|
41
|
-
prerelease: false
|
33
|
+
version: '3.0'
|
34
|
+
- !ruby/object:Gem::Dependency
|
42
35
|
name: rake
|
43
36
|
requirement: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
44
38
|
requirements:
|
45
39
|
- - ! '>='
|
46
40
|
- !ruby/object:Gem::Version
|
47
41
|
version: '0'
|
48
|
-
none: false
|
49
42
|
type: :runtime
|
50
|
-
|
43
|
+
prerelease: false
|
51
44
|
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
52
46
|
requirements:
|
53
47
|
- - ! '>='
|
54
48
|
- !ruby/object:Gem::Version
|
55
49
|
version: '0'
|
56
|
-
|
57
|
-
prerelease: false
|
50
|
+
- !ruby/object:Gem::Dependency
|
58
51
|
name: json
|
59
52
|
requirement: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
60
54
|
requirements:
|
61
55
|
- - ! '>='
|
62
56
|
- !ruby/object:Gem::Version
|
63
57
|
version: '0'
|
64
|
-
none: false
|
65
58
|
type: :runtime
|
66
|
-
|
59
|
+
prerelease: false
|
67
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
68
62
|
requirements:
|
69
63
|
- - ! '>='
|
70
64
|
- !ruby/object:Gem::Version
|
71
65
|
version: '0'
|
72
|
-
|
73
|
-
|
74
|
-
name: rack
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rspec
|
75
68
|
requirement: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
76
70
|
requirements:
|
77
71
|
- - ! '>='
|
78
72
|
- !ruby/object:Gem::Version
|
79
73
|
version: '0'
|
80
|
-
|
81
|
-
|
82
|
-
- !ruby/object:Gem::Dependency
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
83
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
84
78
|
requirements:
|
85
79
|
- - ! '>='
|
86
80
|
- !ruby/object:Gem::Version
|
87
81
|
version: '0'
|
88
|
-
|
89
|
-
|
90
|
-
name: rspec
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: capistrano
|
91
84
|
requirement: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
92
86
|
requirements:
|
93
87
|
- - ! '>='
|
94
88
|
- !ruby/object:Gem::Version
|
95
89
|
version: '0'
|
96
|
-
none: false
|
97
90
|
type: :development
|
98
|
-
|
91
|
+
prerelease: false
|
99
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
100
94
|
requirements:
|
101
95
|
- - ! '>='
|
102
96
|
- !ruby/object:Gem::Version
|
103
97
|
version: '0'
|
104
|
-
|
105
|
-
|
106
|
-
name: capistrano
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: generator_spec
|
107
100
|
requirement: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
108
102
|
requirements:
|
109
103
|
- - ! '>='
|
110
104
|
- !ruby/object:Gem::Version
|
111
105
|
version: '0'
|
112
|
-
none: false
|
113
106
|
type: :development
|
114
|
-
|
107
|
+
prerelease: false
|
115
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
116
110
|
requirements:
|
117
111
|
- - ! '>='
|
118
112
|
- !ruby/object:Gem::Version
|
119
113
|
version: '0'
|
120
|
-
|
121
|
-
|
122
|
-
name: generator_spec
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: pry
|
123
116
|
requirement: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
124
118
|
requirements:
|
125
119
|
- - ! '>='
|
126
120
|
- !ruby/object:Gem::Version
|
127
121
|
version: '0'
|
128
|
-
none: false
|
129
122
|
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
130
|
description: The official appsignal.com gem
|
131
131
|
email:
|
132
132
|
- contact@appsignal.com
|
@@ -136,7 +136,7 @@ extensions: []
|
|
136
136
|
extra_rdoc_files: []
|
137
137
|
files:
|
138
138
|
- .gitignore
|
139
|
-
- .
|
139
|
+
- .ruby-version
|
140
140
|
- .travis.yml
|
141
141
|
- Gemfile
|
142
142
|
- LICENCE
|
@@ -151,20 +151,25 @@ files:
|
|
151
151
|
- gemfiles/edge.gemfile
|
152
152
|
- lib/appsignal.rb
|
153
153
|
- lib/appsignal/agent.rb
|
154
|
+
- lib/appsignal/aggregator.rb
|
155
|
+
- lib/appsignal/aggregator/post_processor.rb
|
154
156
|
- lib/appsignal/auth_check.rb
|
155
157
|
- lib/appsignal/capistrano.rb
|
156
158
|
- lib/appsignal/careful_logger.rb
|
157
159
|
- lib/appsignal/cli.rb
|
158
160
|
- lib/appsignal/config.rb
|
159
161
|
- lib/appsignal/exception_notification.rb
|
162
|
+
- lib/appsignal/listener.rb
|
160
163
|
- lib/appsignal/marker.rb
|
161
164
|
- lib/appsignal/middleware.rb
|
165
|
+
- lib/appsignal/middleware/action_view_sanitizer.rb
|
166
|
+
- lib/appsignal/middleware/active_record_sanitizer.rb
|
167
|
+
- lib/appsignal/middleware/chain.rb
|
168
|
+
- lib/appsignal/middleware/delete_blanks.rb
|
162
169
|
- lib/appsignal/railtie.rb
|
170
|
+
- lib/appsignal/to_appsignal_hash.rb
|
163
171
|
- lib/appsignal/transaction.rb
|
164
|
-
- lib/appsignal/transaction/faulty_request_formatter.rb
|
165
172
|
- lib/appsignal/transaction/params_sanitizer.rb
|
166
|
-
- lib/appsignal/transaction/regular_request_formatter.rb
|
167
|
-
- lib/appsignal/transaction/slow_request_formatter.rb
|
168
173
|
- lib/appsignal/transaction/transaction_formatter.rb
|
169
174
|
- lib/appsignal/transmitter.rb
|
170
175
|
- lib/appsignal/version.rb
|
@@ -174,19 +179,23 @@ files:
|
|
174
179
|
- log/.gitkeep
|
175
180
|
- resources/cacert.pem
|
176
181
|
- spec/appsignal/agent_spec.rb
|
182
|
+
- spec/appsignal/aggregator/post_processor_spec.rb
|
183
|
+
- spec/appsignal/aggregator_spec.rb
|
177
184
|
- spec/appsignal/auth_check_spec.rb
|
178
185
|
- spec/appsignal/capistrano_spec.rb
|
179
186
|
- spec/appsignal/cli_spec.rb
|
180
187
|
- spec/appsignal/config_spec.rb
|
181
188
|
- spec/appsignal/exception_notification_spec.rb
|
182
189
|
- spec/appsignal/inactive_railtie_spec.rb
|
190
|
+
- spec/appsignal/listener_spec.rb
|
183
191
|
- spec/appsignal/marker_spec.rb
|
184
|
-
- spec/appsignal/
|
192
|
+
- spec/appsignal/middleware/action_view_sanitizer_spec.rb
|
193
|
+
- spec/appsignal/middleware/active_record_sanitizer_spec.rb
|
194
|
+
- spec/appsignal/middleware/chain_spec.rb
|
195
|
+
- spec/appsignal/middleware/delete_blanks_spec.rb
|
185
196
|
- spec/appsignal/railtie_spec.rb
|
186
|
-
- spec/appsignal/
|
197
|
+
- spec/appsignal/to_appsignal_hash_spec.rb
|
187
198
|
- spec/appsignal/transaction/params_sanitizer_spec.rb
|
188
|
-
- spec/appsignal/transaction/regular_request_formatter_spec.rb
|
189
|
-
- spec/appsignal/transaction/slow_request_formatter_spec.rb
|
190
199
|
- spec/appsignal/transaction/transaction_formatter_spec.rb
|
191
200
|
- spec/appsignal/transaction_spec.rb
|
192
201
|
- spec/appsignal/transmitter_spec.rb
|
@@ -194,6 +203,8 @@ files:
|
|
194
203
|
- spec/generators/appsignal/appsignal_generator_spec.rb
|
195
204
|
- spec/spec_helper.rb
|
196
205
|
- spec/support/delegate_matcher.rb
|
206
|
+
- spec/support/helpers/notification_helpers.rb
|
207
|
+
- spec/support/helpers/transaction_helpers.rb
|
197
208
|
homepage: http://github.com/80beans/appsignal
|
198
209
|
licenses: []
|
199
210
|
post_install_message:
|
@@ -201,44 +212,42 @@ rdoc_options: []
|
|
201
212
|
require_paths:
|
202
213
|
- lib
|
203
214
|
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
none: false
|
204
216
|
requirements:
|
205
217
|
- - ! '>='
|
206
218
|
- !ruby/object:Gem::Version
|
207
219
|
version: '0'
|
208
|
-
segments:
|
209
|
-
- 0
|
210
|
-
hash: -3341543659726681693
|
211
|
-
none: false
|
212
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
|
+
none: false
|
213
222
|
requirements:
|
214
223
|
- - ! '>='
|
215
224
|
- !ruby/object:Gem::Version
|
216
225
|
version: '0'
|
217
|
-
segments:
|
218
|
-
- 0
|
219
|
-
hash: -3341543659726681693
|
220
|
-
none: false
|
221
226
|
requirements: []
|
222
227
|
rubyforge_project:
|
223
|
-
rubygems_version: 1.8.
|
228
|
+
rubygems_version: 1.8.23
|
224
229
|
signing_key:
|
225
230
|
specification_version: 3
|
226
231
|
summary: Logs performance and exception data from your app toappsignal.com
|
227
232
|
test_files:
|
228
233
|
- spec/appsignal/agent_spec.rb
|
234
|
+
- spec/appsignal/aggregator/post_processor_spec.rb
|
235
|
+
- spec/appsignal/aggregator_spec.rb
|
229
236
|
- spec/appsignal/auth_check_spec.rb
|
230
237
|
- spec/appsignal/capistrano_spec.rb
|
231
238
|
- spec/appsignal/cli_spec.rb
|
232
239
|
- spec/appsignal/config_spec.rb
|
233
240
|
- spec/appsignal/exception_notification_spec.rb
|
234
241
|
- spec/appsignal/inactive_railtie_spec.rb
|
242
|
+
- spec/appsignal/listener_spec.rb
|
235
243
|
- spec/appsignal/marker_spec.rb
|
236
|
-
- spec/appsignal/
|
244
|
+
- spec/appsignal/middleware/action_view_sanitizer_spec.rb
|
245
|
+
- spec/appsignal/middleware/active_record_sanitizer_spec.rb
|
246
|
+
- spec/appsignal/middleware/chain_spec.rb
|
247
|
+
- spec/appsignal/middleware/delete_blanks_spec.rb
|
237
248
|
- spec/appsignal/railtie_spec.rb
|
238
|
-
- spec/appsignal/
|
249
|
+
- spec/appsignal/to_appsignal_hash_spec.rb
|
239
250
|
- spec/appsignal/transaction/params_sanitizer_spec.rb
|
240
|
-
- spec/appsignal/transaction/regular_request_formatter_spec.rb
|
241
|
-
- spec/appsignal/transaction/slow_request_formatter_spec.rb
|
242
251
|
- spec/appsignal/transaction/transaction_formatter_spec.rb
|
243
252
|
- spec/appsignal/transaction_spec.rb
|
244
253
|
- spec/appsignal/transmitter_spec.rb
|
@@ -246,3 +255,5 @@ test_files:
|
|
246
255
|
- spec/generators/appsignal/appsignal_generator_spec.rb
|
247
256
|
- spec/spec_helper.rb
|
248
257
|
- spec/support/delegate_matcher.rb
|
258
|
+
- spec/support/helpers/notification_helpers.rb
|
259
|
+
- spec/support/helpers/transaction_helpers.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.3
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Appsignal
|
2
|
-
class TransactionFormatter
|
3
|
-
class FaultyRequestFormatter < Appsignal::TransactionFormatter
|
4
|
-
|
5
|
-
def to_hash
|
6
|
-
super.merge :exception => formatted_exception
|
7
|
-
end
|
8
|
-
|
9
|
-
protected
|
10
|
-
|
11
|
-
def_delegators :exception, :backtrace, :name, :message
|
12
|
-
|
13
|
-
def formatted_exception
|
14
|
-
{
|
15
|
-
:backtrace => backtrace,
|
16
|
-
:exception => name,
|
17
|
-
:message => message
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
def basic_process_action_event
|
22
|
-
super.merge(
|
23
|
-
:environment => filtered_environment,
|
24
|
-
:session_data => request.session
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Appsignal
|
2
|
-
class TransactionFormatter
|
3
|
-
class SlowRequestFormatter < Appsignal::TransactionFormatter
|
4
|
-
|
5
|
-
def to_hash
|
6
|
-
super.merge :events => detailed_events
|
7
|
-
end
|
8
|
-
|
9
|
-
protected
|
10
|
-
|
11
|
-
def detailed_events
|
12
|
-
events.map { |event| format(event) }
|
13
|
-
end
|
14
|
-
|
15
|
-
def format(event)
|
16
|
-
{
|
17
|
-
:name => event.name,
|
18
|
-
:duration => event.duration,
|
19
|
-
:time => event.time.to_f,
|
20
|
-
:end => event.end.to_f,
|
21
|
-
:payload => sanitized_event_payload(event)
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
def basic_process_action_event
|
26
|
-
super.merge(
|
27
|
-
:environment => filtered_environment,
|
28
|
-
:session_data => request.session
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|