appsignal 0.11.8.beta.1 → 0.11.8.beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@
2
2
  * Add frontend error catcher
3
3
  * Add background job metadata (queue, priority etc.) to transaction overview
4
4
  * Add APPSIGNAL_APP_ENV variable to Rails config, so you can override the environment
5
+ * Handle http queue times in microseconds too
5
6
 
6
7
  # 0.11.7
7
8
  * Add option to override Job name in Delayed Job
data/Rakefile CHANGED
@@ -141,3 +141,5 @@ task :console do
141
141
  ARGV.clear
142
142
  IRB.start
143
143
  end
144
+
145
+ task :default => [:generate_bundle_and_spec_all, :spec]
@@ -20,12 +20,13 @@ if defined?(::Delayed::Plugin)
20
20
 
21
21
  Appsignal.monitor_transaction(
22
22
  'perform_job.delayed_job',
23
- :class => class_name,
24
- :method => method_name,
23
+ :class => class_name,
24
+ :method => method_name,
25
25
  :metadata => {
26
- :priority => job.priority,
27
- :attempts => job.attempts,
26
+ :id => job.id,
28
27
  :queue => job.queue,
28
+ :priority => job.priority || 0,
29
+ :attempts => job.attempts || 0
29
30
  },
30
31
  :queue_start => job.created_at
31
32
  ) do
@@ -181,9 +181,13 @@ module Appsignal
181
181
  env_var = env['HTTP_X_QUEUE_START'] || env['HTTP_X_REQUEST_START']
182
182
  if env_var
183
183
  Appsignal.logger.debug("Setting http queue start: #{env_var}")
184
- value = env_var.tr('^0-9', '')
185
- unless value.empty?
186
- @queue_start = value.to_f / 1000.0
184
+ cleaned_value = env_var.tr('^0-9', '')
185
+ unless cleaned_value.empty?
186
+ value = cleaned_value.to_i
187
+ [1_000_000.0, 1_000.0].each do |factor|
188
+ @queue_start = value / factor
189
+ break if @queue_start > 946_681_200.0 # Ok if it's later than 2000
190
+ end
187
191
  end
188
192
  end
189
193
  end
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.11.8.beta.1'
2
+ VERSION = '0.11.8.beta.2'
3
3
  end
@@ -30,6 +30,7 @@ describe "Delayed Job integration" do
30
30
  let(:time) { Time.parse('01-01-2001 10:01:00UTC') }
31
31
  let(:job) do
32
32
  double(
33
+ :id => 123,
33
34
  :name => 'TestClass#perform',
34
35
  :priority => 1,
35
36
  :attempts => 1,
@@ -51,6 +52,7 @@ describe "Delayed Job integration" do
51
52
  :priority => 1,
52
53
  :attempts => 1,
53
54
  :queue => 'default',
55
+ :id => 123
54
56
  },
55
57
  :queue_start => time - 60_000,
56
58
  )
@@ -66,10 +68,11 @@ describe "Delayed Job integration" do
66
68
  :payload_object => double(
67
69
  :appsignal_name => 'CustomClass#perform'
68
70
  ),
69
- :name => 'TestClass#perform',
70
- :priority => 1,
71
- :attempts => 1,
72
- :queue => 'default',
71
+ :id => 123,
72
+ :name => 'TestClass#perform',
73
+ :priority => 1,
74
+ :attempts => 1,
75
+ :queue => 'default',
73
76
  :created_at => time - 60_000
74
77
  )
75
78
  end
@@ -82,6 +85,7 @@ describe "Delayed Job integration" do
82
85
  :priority => 1,
83
86
  :attempts => 1,
84
87
  :queue => 'default',
88
+ :id => 123
85
89
  },
86
90
  :queue_start => time - 60_000
87
91
  )
@@ -482,45 +482,59 @@ describe Appsignal::Transaction do
482
482
 
483
483
  describe "#set_http_queue_start" do
484
484
  let(:slightly_earlier_time) { fixed_time - 0.4 }
485
- let(:slightly_earlier_time_in_ms) { (slightly_earlier_time.to_f * 1000).to_i }
485
+ let(:slightly_earlier_time_value) { (slightly_earlier_time * factor).to_i }
486
486
  before { transaction.set_http_queue_start }
487
487
  subject { transaction.queue_start }
488
488
 
489
- context "without env" do
490
- let(:env) { nil }
489
+ shared_examples "http queue start" do
490
+ context "without env" do
491
+ let(:env) { nil }
491
492
 
492
- it { should be_nil }
493
- end
493
+ it { should be_nil }
494
+ end
494
495
 
495
- context "with no relevant header set" do
496
- let(:env) { {} }
496
+ context "with no relevant header set" do
497
+ let(:env) { {} }
497
498
 
498
- it { should be_nil }
499
- end
499
+ it { should be_nil }
500
+ end
500
501
 
501
- context "with the HTTP_X_REQUEST_START header set" do
502
- let(:env) { {'HTTP_X_REQUEST_START' => "t=#{slightly_earlier_time_in_ms}"} }
502
+ context "with the HTTP_X_REQUEST_START header set" do
503
+ let(:env) { {'HTTP_X_REQUEST_START' => "t=#{slightly_earlier_time_value}"} }
503
504
 
504
- it { should == 1389783599.6 }
505
+ it { should == 1389783599.6 }
505
506
 
506
- context "with unparsable content" do
507
- let(:env) { {'HTTP_X_REQUEST_START' => 'something'} }
507
+ context "with unparsable content" do
508
+ let(:env) { {'HTTP_X_REQUEST_START' => 'something'} }
508
509
 
509
- it { should be_nil }
510
- end
510
+ it { should be_nil }
511
+ end
511
512
 
512
- context "with some cruft" do
513
- let(:env) { {'HTTP_X_REQUEST_START' => "t=#{slightly_earlier_time_in_ms}aaaa"} }
513
+ context "with some cruft" do
514
+ let(:env) { {'HTTP_X_REQUEST_START' => "t=#{slightly_earlier_time_value}aaaa"} }
514
515
 
515
- it { should == 1389783599.6 }
516
- end
516
+ it { should == 1389783599.6 }
517
+ end
517
518
 
518
- context "with the alternate HTTP_X_QUEUE_START header set" do
519
- let(:env) { {'HTTP_X_QUEUE_START' => "t=#{slightly_earlier_time_in_ms}"} }
519
+ context "with the alternate HTTP_X_QUEUE_START header set" do
520
+ let(:env) { {'HTTP_X_QUEUE_START' => "t=#{slightly_earlier_time_value}"} }
520
521
 
521
- it { should == 1389783599.6 }
522
+ it { should == 1389783599.6 }
523
+ end
522
524
  end
523
525
  end
526
+
527
+ context "time in miliseconds" do
528
+ let(:factor) { 1_000 }
529
+
530
+ it_should_behave_like "http queue start"
531
+ end
532
+
533
+ context "time in microseconds" do
534
+ let(:factor) { 1_000_000 }
535
+
536
+ it_should_behave_like "http queue start"
537
+ end
524
538
  end
525
539
 
526
540
  # protected
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.11.8.beta.1
4
+ version: 0.11.8.beta.2
5
+ prerelease: 7
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-03-05 00:00:00.000000000 Z
16
+ date: 2015-03-12 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
@@ -120,9 +135,9 @@ executables:
120
135
  extensions: []
121
136
  extra_rdoc_files: []
122
137
  files:
123
- - ".gitignore"
124
- - ".rspec"
125
- - ".travis.yml"
138
+ - .gitignore
139
+ - .rspec
140
+ - .travis.yml
126
141
  - CHANGELOG.md
127
142
  - Gemfile
128
143
  - LICENSE
@@ -242,26 +257,27 @@ files:
242
257
  homepage: https://github.com/appsignal/appsignal
243
258
  licenses:
244
259
  - MIT
245
- metadata: {}
246
260
  post_install_message:
247
261
  rdoc_options: []
248
262
  require_paths:
249
263
  - lib
250
264
  required_ruby_version: !ruby/object:Gem::Requirement
265
+ none: false
251
266
  requirements:
252
- - - ">="
267
+ - - ! '>='
253
268
  - !ruby/object:Gem::Version
254
269
  version: '1.9'
255
270
  required_rubygems_version: !ruby/object:Gem::Requirement
271
+ none: false
256
272
  requirements:
257
- - - ">"
273
+ - - ! '>'
258
274
  - !ruby/object:Gem::Version
259
275
  version: 1.3.1
260
276
  requirements: []
261
277
  rubyforge_project:
262
- rubygems_version: 2.2.2
278
+ rubygems_version: 1.8.23
263
279
  signing_key:
264
- specification_version: 4
280
+ specification_version: 3
265
281
  summary: Logs performance and exception data from your app to appsignal.com
266
282
  test_files:
267
283
  - spec/lib/appsignal/agent_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: d352412d00bbd2c1cf81315d80ae4a5c08d8115e
4
- data.tar.gz: df2cda49d433880e1c89b5c42c1c12cf1abb65bd
5
- SHA512:
6
- metadata.gz: 8347c842bde632030871bbe90392115a744d1676d1afc98c9f796987b587be7ce5d8c56a742019dd004b1f8b580fc05a9250e2b59ed099ef555d6e31052b1deb
7
- data.tar.gz: cda5f26ebd0b612f46feca9952f1e420c6370e89e9682e8879e91f1250e9d47edcee7ff61e2cd5b11f6c2e0b08ae1a063451e92e008f1bc4cc10e1d006ec48ca