appsignal 0.8.0 → 0.8.1.beta.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +3 -0
- data/lib/appsignal/integrations/sidekiq.rb +1 -2
- data/lib/appsignal/transaction.rb +8 -9
- data/lib/appsignal/transaction/formatter.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +1 -1
- data/spec/lib/appsignal/transaction_spec.rb +36 -17
- data/spec/support/helpers/notification_helpers.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDBhODkxNDkwODA4NjY4Yjc5Zjc0Zjk2MTJiNmEwMjU2YjYxZjZjZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzI5ZmExYmE1NGMxM2IyZGU1YzE0YWE4NjY5MjEzMzY0NWUxNWM3NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODE2NGY5Zjc2Mjc0MTYzMmIwNGEyYThkNTQ5NGUxNzllYzAxOTYxMGVhMjQ5
|
10
|
+
MDg2NTdjMzFlNDk3YmQwN2ZlMzQ0NzhhNGYxYzI5MzRhZjVjZGNlNzZhZDI1
|
11
|
+
ODk1OWQ4OTUxMTAwOWRmOGIyODlmOGJlMGY3M2RhOTRiN2UxNjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjQ5NmQxOGYzZGU3MDI4MzRkNDk3NDkzOTNhZjliODMyYTQ3ZmE4NzQxZmFk
|
14
|
+
MTMxNzdkZWQ4MWM4ZDU2NWQ0M2NkZmNiYTNmNzg4MjViOWE3OWU5OWI3MDQ3
|
15
|
+
YzE1MDVhN2IyZGE2Mzk1ZDdjOTU5ODBhNGU0MzAyODg3YWMyZWU=
|
data/CHANGELOG.md
CHANGED
@@ -6,14 +6,13 @@ if defined?(::Sidekiq)
|
|
6
6
|
class SidekiqPlugin
|
7
7
|
def call(worker, item, queue)
|
8
8
|
Appsignal::Transaction.create(SecureRandom.uuid, ENV.to_hash)
|
9
|
-
|
10
9
|
ActiveSupport::Notifications.instrument(
|
11
10
|
'perform_job.sidekiq',
|
12
11
|
:class => item['class'],
|
13
12
|
:method => 'perform',
|
14
13
|
:attempts => item['retry_count'],
|
15
14
|
:queue => item['queue'],
|
16
|
-
:
|
15
|
+
:queue_start => item['enqueued_at']
|
17
16
|
) do
|
18
17
|
yield
|
19
18
|
end
|
@@ -22,7 +22,7 @@ module Appsignal
|
|
22
22
|
end
|
23
23
|
|
24
24
|
attr_reader :request_id, :events, :process_action_event, :action, :exception,
|
25
|
-
:env, :fullpath, :time, :tags, :kind
|
25
|
+
:env, :fullpath, :time, :tags, :kind, :queue_start
|
26
26
|
|
27
27
|
def initialize(request_id, env)
|
28
28
|
@request_id = request_id
|
@@ -54,6 +54,7 @@ module Appsignal
|
|
54
54
|
return unless event && event.payload
|
55
55
|
@action = "#{event.payload[:controller]}##{event.payload[:action]}"
|
56
56
|
@kind = 'http_request'
|
57
|
+
set_http_queue_start
|
57
58
|
end
|
58
59
|
|
59
60
|
def set_perform_job_event(event)
|
@@ -61,6 +62,7 @@ module Appsignal
|
|
61
62
|
return unless event && event.payload
|
62
63
|
@action = "#{event.payload[:class]}##{event.payload[:method]}"
|
63
64
|
@kind = 'background_job'
|
65
|
+
set_background_queue_start
|
64
66
|
end
|
65
67
|
|
66
68
|
def add_event(event)
|
@@ -121,21 +123,18 @@ module Appsignal
|
|
121
123
|
end
|
122
124
|
end
|
123
125
|
|
124
|
-
def
|
125
|
-
|
126
|
-
|
127
|
-
else
|
128
|
-
http_queue_start
|
129
|
-
end
|
126
|
+
def set_background_queue_start
|
127
|
+
return unless process_action_event.payload[:queue_start]
|
128
|
+
@queue_start = process_action_event.payload[:queue_start].to_f
|
130
129
|
end
|
131
130
|
|
132
|
-
def
|
131
|
+
def set_http_queue_start
|
133
132
|
return unless env
|
134
133
|
env_var = env['HTTP_X_QUEUE_START'] || env['HTTP_X_REQUEST_START']
|
135
134
|
if env_var
|
136
135
|
value = env_var.tr('^0-9', '')
|
137
136
|
unless value.empty?
|
138
|
-
value.to_f / 1_000_000
|
137
|
+
@queue_start = value.to_f / 1_000_000
|
139
138
|
end
|
140
139
|
end
|
141
140
|
end
|
data/lib/appsignal/version.rb
CHANGED
@@ -32,7 +32,8 @@ describe Appsignal::Transaction do
|
|
32
32
|
{
|
33
33
|
'HTTP_USER_AGENT' => 'IE6',
|
34
34
|
'SERVER_NAME' => 'localhost',
|
35
|
-
'action_dispatch.routes' => 'not_available'
|
35
|
+
'action_dispatch.routes' => 'not_available',
|
36
|
+
'HTTP_X_REQUEST_START' => '1000000'
|
36
37
|
}
|
37
38
|
end
|
38
39
|
let(:transaction) { Appsignal::Transaction.create('1', env) }
|
@@ -45,6 +46,7 @@ describe Appsignal::Transaction do
|
|
45
46
|
|
46
47
|
describe '#set_process_action_event' do
|
47
48
|
before { transaction.set_process_action_event(process_action_event) }
|
49
|
+
|
48
50
|
let(:process_action_event) { notification_event }
|
49
51
|
|
50
52
|
it 'should add a process action event' do
|
@@ -58,14 +60,20 @@ describe Appsignal::Transaction do
|
|
58
60
|
it "should set the kind" do
|
59
61
|
transaction.kind.should == 'http_request'
|
60
62
|
end
|
63
|
+
|
64
|
+
it "should call set_http_queue_start" do
|
65
|
+
transaction.queue_start.should_not be_nil
|
66
|
+
end
|
61
67
|
end
|
62
68
|
|
63
69
|
describe "set_perform_job_event" do
|
64
70
|
before { transaction.set_perform_job_event(perform_job_event) }
|
71
|
+
|
72
|
+
let(:payload) { create_background_payload }
|
65
73
|
let(:perform_job_event) do
|
66
74
|
notification_event(
|
67
75
|
:name => 'perform_job.delayed_job',
|
68
|
-
:payload =>
|
76
|
+
:payload => payload
|
69
77
|
)
|
70
78
|
end
|
71
79
|
|
@@ -80,6 +88,10 @@ describe Appsignal::Transaction do
|
|
80
88
|
it "should set the kind" do
|
81
89
|
transaction.kind.should == 'background_job'
|
82
90
|
end
|
91
|
+
|
92
|
+
it "should set call set_background_queue_start" do
|
93
|
+
transaction.queue_start.should_not be_nil
|
94
|
+
end
|
83
95
|
end
|
84
96
|
|
85
97
|
describe "#set_tags" do
|
@@ -316,39 +328,46 @@ describe Appsignal::Transaction do
|
|
316
328
|
end
|
317
329
|
end
|
318
330
|
|
319
|
-
describe "#
|
331
|
+
describe "#set_background_queue_start" do
|
332
|
+
before do
|
333
|
+
transaction.stub(:process_action_event =>
|
334
|
+
notification_event(
|
335
|
+
:name => 'perform_job.delayed_job',
|
336
|
+
:payload => payload
|
337
|
+
)
|
338
|
+
)
|
339
|
+
transaction.set_background_queue_start
|
340
|
+
end
|
320
341
|
subject { transaction.queue_start }
|
321
342
|
|
322
|
-
context "
|
323
|
-
let(:
|
343
|
+
context "when queue start is nil" do
|
344
|
+
let(:payload) { create_background_payload(:queue_start => nil) }
|
324
345
|
|
325
|
-
it
|
326
|
-
transaction.should_receive(:http_queue_start)
|
327
|
-
subject
|
328
|
-
end
|
346
|
+
it { should be_nil }
|
329
347
|
end
|
330
348
|
|
331
|
-
context "
|
332
|
-
let(:
|
349
|
+
context "when queue start is set" do
|
350
|
+
let(:payload) { create_background_payload }
|
333
351
|
|
334
|
-
it
|
335
|
-
subject.should == 978364850.0
|
336
|
-
end
|
352
|
+
it { should == 978364850.0 }
|
337
353
|
end
|
338
354
|
end
|
339
355
|
|
340
|
-
describe "#
|
356
|
+
describe "#set_http_queue_start" do
|
341
357
|
let(:slightly_earlier_time) { fixed_time - 10.0 }
|
342
358
|
let(:slightly_earlier_time_in_msec) { (slightly_earlier_time.to_f * 1_000_000).to_i }
|
343
|
-
|
359
|
+
before { transaction.set_http_queue_start }
|
360
|
+
subject { transaction.queue_start }
|
344
361
|
|
345
|
-
context "without
|
362
|
+
context "without env" do
|
346
363
|
let(:env) { nil }
|
347
364
|
|
348
365
|
it { should be_nil }
|
349
366
|
end
|
350
367
|
|
351
368
|
context "with no relevant header set" do
|
369
|
+
let(:env) { {} }
|
370
|
+
|
352
371
|
it { should be_nil }
|
353
372
|
end
|
354
373
|
|
@@ -12,7 +12,7 @@ module NotificationHelpers
|
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
15
|
-
def create_payload(args
|
15
|
+
def create_payload(args={})
|
16
16
|
{
|
17
17
|
:path => '/blog',
|
18
18
|
:action => 'show',
|
@@ -33,6 +33,6 @@ module NotificationHelpers
|
|
33
33
|
:attempts => 0,
|
34
34
|
:queue => 'default',
|
35
35
|
:queue_start => fixed_time - 10,
|
36
|
-
}
|
36
|
+
}.merge(args)
|
37
37
|
end
|
38
38
|
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.8.0
|
4
|
+
version: 0.8.1.beta.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-01-
|
15
|
+
date: 2014-01-04 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -237,9 +237,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
237
|
version: 1.9.3
|
238
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
239
|
requirements:
|
240
|
-
- - ! '
|
240
|
+
- - ! '>'
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
242
|
+
version: 1.3.1
|
243
243
|
requirements: []
|
244
244
|
rubyforge_project:
|
245
245
|
rubygems_version: 2.0.3
|