appsignal 0.8.1.beta.0 → 0.8.1.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDBhODkxNDkwODA4NjY4Yjc5Zjc0Zjk2MTJiNmEwMjU2YjYxZjZjZg==
4
+ MDVkNjBlODY5OTYzNTYwOWFiNzkzYjY3NzY1NTJhNjZkYmNmNDVmOQ==
5
5
  data.tar.gz: !binary |-
6
- NzI5ZmExYmE1NGMxM2IyZGU1YzE0YWE4NjY5MjEzMzY0NWUxNWM3NA==
6
+ OWZjNGJiYjY2MzAwNDE2ZDk4NjY2MGU5OWJlMDJjODExNDRhMTAxNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODE2NGY5Zjc2Mjc0MTYzMmIwNGEyYThkNTQ5NGUxNzllYzAxOTYxMGVhMjQ5
10
- MDg2NTdjMzFlNDk3YmQwN2ZlMzQ0NzhhNGYxYzI5MzRhZjVjZGNlNzZhZDI1
11
- ODk1OWQ4OTUxMTAwOWRmOGIyODlmOGJlMGY3M2RhOTRiN2UxNjc=
9
+ MDE4N2EyYjE0MzE5M2Y3NWI1NTk0N2YxMTM0YmMzMzk3ZjY2Mzc4MTRmZTEy
10
+ NWMyM2E1ZjYwZmU3OWJlNjQwYTE5OTU2MGI4NmQ0MTA0YTExNTQ4YzJlZmQy
11
+ ZmI1NGY0M2JiNjU3ODA0OGNmYjU3NmEwZjkzMTAwYjgwMzc3Yjg=
12
12
  data.tar.gz: !binary |-
13
- YjQ5NmQxOGYzZGU3MDI4MzRkNDk3NDkzOTNhZjliODMyYTQ3ZmE4NzQxZmFk
14
- MTMxNzdkZWQ4MWM4ZDU2NWQ0M2NkZmNiYTNmNzg4MjViOWE3OWU5OWI3MDQ3
15
- YzE1MDVhN2IyZGE2Mzk1ZDdjOTU5ODBhNGU0MzAyODg3YWMyZWU=
13
+ Njc3ZmU3N2Y1Yjc2MWQzZDdmYzBmYjI0NmM5NzA3OGIzNTdkM2Y2ZGZjOTM3
14
+ MWYzMjJlYmYzMjAwMTc2OTc4MWYyMjQ0Y2RiNzg4ZGQwZDYyMTk0NzhiMTY0
15
+ MzYwMTE0OWM3MWE4NGIyNDAwYzRjMzJiN2NkYzE1ZWVkZDczNzA=
@@ -124,17 +124,20 @@ module Appsignal
124
124
  end
125
125
 
126
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
127
+ queue_start = process_action_event.payload[:queue_start]
128
+ return unless queue_start
129
+ Appsignal.logger.debug("Setting background queue start: #{queue_start}")
130
+ @queue_start = queue_start.to_f
129
131
  end
130
132
 
131
133
  def set_http_queue_start
132
134
  return unless env
133
135
  env_var = env['HTTP_X_QUEUE_START'] || env['HTTP_X_REQUEST_START']
134
136
  if env_var
137
+ Appsignal.logger.debug("Setting http queue start: #{env_var}")
135
138
  value = env_var.tr('^0-9', '')
136
139
  unless value.empty?
137
- @queue_start = value.to_f / 1_000_000
140
+ @queue_start = value.to_f / 1000
138
141
  end
139
142
  end
140
143
  end
@@ -49,10 +49,8 @@ module Appsignal
49
49
  end
50
50
 
51
51
  def add_queue_duration_to_hash!
52
- start = queue_start || 0.0
53
- if start > 0
54
- hash[:log_entry][:queue_duration] = hash[:log_entry][:time] - start
55
- end
52
+ return unless queue_start && queue_start > 0
53
+ hash[:log_entry][:queue_duration] = hash[:log_entry][:time] - queue_start
56
54
  end
57
55
 
58
56
  def add_tags_to_hash!
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.8.1.beta.0'
2
+ VERSION = '0.8.1.beta.1'
3
3
  end
@@ -114,7 +114,8 @@ describe Appsignal::Transaction::Formatter do
114
114
  end
115
115
 
116
116
  context "with a background request" do
117
- let(:transaction) { background_job_transaction }
117
+ let(:payload) { create_background_payload }
118
+ let(:transaction) { background_job_transaction({}, payload) }
118
119
  before { transaction.truncate! }
119
120
 
120
121
  its(:keys) { should =~ [:request_id, :log_entry, :failed] }
@@ -134,6 +135,16 @@ describe Appsignal::Transaction::Formatter do
134
135
  :time => 978364860.0,
135
136
  } }
136
137
  its([:failed]) { should be_false }
138
+
139
+ context "when queue_time is zero" do
140
+ let(:payload) { create_background_payload(:queue_start => 0) }
141
+
142
+ context "log entry" do
143
+ subject { formatter.hash[:log_entry] }
144
+
145
+ its([:queue_duration]) { should be_nil }
146
+ end
147
+ end
137
148
  end
138
149
  end
139
150
  end
@@ -355,7 +355,7 @@ describe Appsignal::Transaction do
355
355
 
356
356
  describe "#set_http_queue_start" do
357
357
  let(:slightly_earlier_time) { fixed_time - 10.0 }
358
- let(:slightly_earlier_time_in_msec) { (slightly_earlier_time.to_f * 1_000_000).to_i }
358
+ let(:slightly_earlier_time_in_msec) { (slightly_earlier_time.to_f * 1000).to_i }
359
359
  before { transaction.set_http_queue_start }
360
360
  subject { transaction.queue_start }
361
361
 
@@ -33,7 +33,7 @@ module TransactionHelpers
33
33
  def regular_transaction_with_x_request_start
34
34
  appsignal_transaction(
35
35
  :process_action_event => notification_event,
36
- 'HTTP_X_REQUEST_START' => "t=#{((fixed_time.to_f - 40.0) * 1_000_000).to_i}"
36
+ 'HTTP_X_REQUEST_START' => "t=#{((fixed_time.to_f - 40.0) * 1000).to_i}"
37
37
  )
38
38
  end
39
39
 
@@ -59,7 +59,7 @@ module TransactionHelpers
59
59
  )
60
60
  end
61
61
 
62
- def background_job_transaction(args={})
62
+ def background_job_transaction(args={}, payload=create_background_payload)
63
63
  Appsignal::Transaction.create(
64
64
  '1',
65
65
  {
@@ -70,7 +70,7 @@ module TransactionHelpers
70
70
  o.set_perform_job_event(
71
71
  notification_event(
72
72
  :name => 'perform_job.delayed_job',
73
- :payload => create_background_payload
73
+ :payload => payload
74
74
  )
75
75
  )
76
76
  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.1.beta.0
4
+ version: 0.8.1.beta.1
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-04 00:00:00.000000000 Z
15
+ date: 2014-01-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport