appsignal 2.0.4 → 2.0.5.beta.1
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/ext/agent.yml +11 -11
- data/gemfiles/rails-4.2.gemfile +4 -0
- data/gemfiles/resque.gemfile +4 -0
- data/lib/appsignal/transaction.rb +68 -13
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +2 -2
- data/spec/lib/appsignal/transaction_spec.rb +48 -8
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 329070b96ca1a7f2e2c9a77c5abc9e267783d83e
|
4
|
+
data.tar.gz: 36fae6abc5f7f03f9b12684adae1df0646adbec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbbafdddb5fe71ee3f9616a19c92dc7c23da7e791a531fec1a636bb2cd2d9bf1e76d1876c44bad7247e3ab26ae5aeee3a2399b82a26db86245ea437ef5d89819
|
7
|
+
data.tar.gz: 71a422533810749f8379340e5760d71b01072ff3370d92ba3ab1de026008a54aebda4e8c28d953ad27bb074d9877b965f5813edc0f13c7a3d9a13496ecf593fb
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 2.0.5
|
2
|
+
* Improved logging for agent connection issues
|
3
|
+
* Handle nil request/environments in transactions
|
4
|
+
|
1
5
|
# 2.0.4
|
2
6
|
* Use consistent log format for both file and STDOUT logs. PR #203
|
3
7
|
* Fix log path in `appsignal diagnose` for Rails applications. PR #218, #222
|
data/ext/agent.yml
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: a1cb32f
|
3
3
|
triples:
|
4
4
|
x86_64-linux:
|
5
|
-
checksum:
|
6
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
5
|
+
checksum: 8905166cbd29ad3038d013438781118bb2fa4ea3fef2e7abfe3a4a4d90d7b40c
|
6
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-x86_64-linux-all-static.tar.gz
|
7
7
|
i686-linux:
|
8
|
-
checksum:
|
9
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
8
|
+
checksum: 0ae5f06cf9fd516c7a33cbe29a78016b3b419717870d5fba793345fecb696950
|
9
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-i686-linux-all-static.tar.gz
|
10
10
|
x86-linux:
|
11
|
-
checksum:
|
12
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
11
|
+
checksum: 0ae5f06cf9fd516c7a33cbe29a78016b3b419717870d5fba793345fecb696950
|
12
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-i686-linux-all-static.tar.gz
|
13
13
|
x86_64-darwin:
|
14
|
-
checksum:
|
15
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
14
|
+
checksum: 750e49e56c2024c82adc64471feb855ab7a5caff79cb37978a83e11e31a023ce
|
15
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-x86_64-darwin-all-static.tar.gz
|
16
16
|
universal-darwin:
|
17
|
-
checksum:
|
18
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
17
|
+
checksum: 750e49e56c2024c82adc64471feb855ab7a5caff79cb37978a83e11e31a023ce
|
18
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-x86_64-darwin-all-static.tar.gz
|
data/gemfiles/rails-4.2.gemfile
CHANGED
data/gemfiles/resque.gemfile
CHANGED
@@ -238,23 +238,40 @@ module Appsignal
|
|
238
238
|
|
239
239
|
protected
|
240
240
|
|
241
|
+
# Returns calculated background queue start time in milliseconds, based on
|
242
|
+
# environment values.
|
243
|
+
#
|
244
|
+
# @return [nil] if no {#environment} is present.
|
245
|
+
# @return [nil] if there is no `:queue_start` in the {#environment}.
|
246
|
+
# @return [Integer]
|
241
247
|
def background_queue_start
|
242
|
-
|
243
|
-
return unless
|
248
|
+
env = environment
|
249
|
+
return unless env
|
250
|
+
queue_start = env[:queue_start]
|
251
|
+
return unless queue_start
|
252
|
+
|
244
253
|
(queue_start.to_f * 1000.0).to_i
|
245
254
|
end
|
246
255
|
|
256
|
+
# Returns HTTP queue start time in milliseconds.
|
257
|
+
#
|
258
|
+
# @return [nil] if no queue start time is found.
|
259
|
+
# @return [nil] if begin time is too low to be plausible.
|
260
|
+
# @return [Integer] queue start in milliseconds.
|
247
261
|
def http_queue_start
|
248
|
-
|
249
|
-
return unless
|
250
|
-
|
262
|
+
env = environment
|
263
|
+
return unless env
|
264
|
+
env_var = env["HTTP_X_QUEUE_START".freeze] || env["HTTP_X_REQUEST_START".freeze]
|
265
|
+
return unless env_var
|
266
|
+
cleaned_value = env_var.tr("^0-9".freeze, "".freeze)
|
251
267
|
return if cleaned_value.empty?
|
268
|
+
|
252
269
|
value = cleaned_value.to_i
|
253
270
|
if value > 4_102_441_200_000
|
254
|
-
# Value is in microseconds
|
271
|
+
# Value is in microseconds. Transform to milliseconds.
|
255
272
|
value / 1_000
|
256
273
|
elsif value < 946_681_200_000
|
257
|
-
# Value is
|
274
|
+
# Value is too low to be plausible
|
258
275
|
nil
|
259
276
|
else
|
260
277
|
# Value is in milliseconds
|
@@ -283,24 +300,62 @@ module Appsignal
|
|
283
300
|
Appsignal::Utils::ParamsSanitizer.sanitize params, options
|
284
301
|
end
|
285
302
|
|
303
|
+
# Returns sanitized environment for a transaction.
|
304
|
+
#
|
305
|
+
# The environment of a transaction can contain a lot of information, not
|
306
|
+
# all of it useful for debugging.
|
307
|
+
#
|
308
|
+
# Only the values from the keys specified in `ENV_METHODS` are returned.
|
309
|
+
#
|
310
|
+
# @return [nil] if no environment is present.
|
311
|
+
# @return [Hash<String, Object>]
|
286
312
|
def sanitized_environment
|
287
|
-
|
313
|
+
env = environment
|
314
|
+
return if env.empty?
|
315
|
+
|
288
316
|
{}.tap do |out|
|
289
317
|
ENV_METHODS.each do |key|
|
290
|
-
out[key] =
|
318
|
+
out[key] = env[key] if env[key]
|
291
319
|
end
|
292
320
|
end
|
293
321
|
end
|
294
322
|
|
323
|
+
# Returns sanitized session data.
|
324
|
+
#
|
325
|
+
# The session data is sanitized by the {Appsignal::Utils::ParamsSanitizer}.
|
326
|
+
#
|
327
|
+
# @return [nil] if `:skip_session_data` config is set to `true`.
|
328
|
+
# @return [nil] if the {#request} object doesn't respond to `#session`.
|
329
|
+
# @return [nil] if the {#request} session data is `nil`.
|
330
|
+
# @return [Hash<String, Object>]
|
295
331
|
def sanitized_session_data
|
296
|
-
return if Appsignal.config[:skip_session_data] ||
|
297
|
-
|
332
|
+
return if Appsignal.config[:skip_session_data] ||
|
333
|
+
!request.respond_to?(:session)
|
334
|
+
session = request.session
|
335
|
+
return unless session
|
336
|
+
|
298
337
|
Appsignal::Utils::ParamsSanitizer.sanitize(session.to_hash)
|
299
338
|
end
|
300
339
|
|
340
|
+
# Returns metadata from the environment.
|
341
|
+
#
|
342
|
+
# @return [nil] if no `:metadata` key is present in the {#environment}.
|
343
|
+
# @return [Hash<String, Object>]
|
301
344
|
def metadata
|
302
|
-
|
303
|
-
|
345
|
+
environment[:metadata]
|
346
|
+
end
|
347
|
+
|
348
|
+
# Returns the environment for a transaction.
|
349
|
+
#
|
350
|
+
# Returns an empty Hash when the {#request} object doesn't listen to the
|
351
|
+
# `#env` method or the `#env` is nil.
|
352
|
+
#
|
353
|
+
# @return [Hash<String, Object>]
|
354
|
+
def environment
|
355
|
+
return {} unless request.respond_to?(:env)
|
356
|
+
return {} unless request.env
|
357
|
+
|
358
|
+
request.env
|
304
359
|
end
|
305
360
|
|
306
361
|
# Only keep tags if they meet the following criteria:
|
data/lib/appsignal/version.rb
CHANGED
@@ -338,8 +338,8 @@ describe Appsignal::CLI::Diagnose, :api_stub => true do
|
|
338
338
|
|
339
339
|
it "log files fall back on system tmp directory" do
|
340
340
|
expect(output).to include \
|
341
|
-
%(log_dir_path: "#{system_tmp_dir}"\n - Writable?: yes)
|
342
|
-
%(log_file_path: "#{system_tmp_log_file}"\n -
|
341
|
+
%(log_dir_path: "#{system_tmp_dir}"\n - Writable?: yes),
|
342
|
+
%(log_file_path: "#{system_tmp_log_file}"\n - Exists?: no)
|
343
343
|
end
|
344
344
|
end
|
345
345
|
|
@@ -22,7 +22,7 @@ describe Appsignal::Transaction do
|
|
22
22
|
before { Timecop.freeze(time) }
|
23
23
|
after { Timecop.return }
|
24
24
|
|
25
|
-
|
25
|
+
describe "class methods" do
|
26
26
|
describe ".create" do
|
27
27
|
it "should add the transaction to thread local" do
|
28
28
|
Appsignal::Extension.should_receive(:start_transaction).with('1', 'http_request', 0)
|
@@ -599,6 +599,18 @@ describe Appsignal::Transaction do
|
|
599
599
|
describe "#background_queue_start" do
|
600
600
|
subject { transaction.send(:background_queue_start) }
|
601
601
|
|
602
|
+
context "when request is nil" do
|
603
|
+
let(:request) { nil }
|
604
|
+
|
605
|
+
it { should eq nil }
|
606
|
+
end
|
607
|
+
|
608
|
+
context "when env is nil" do
|
609
|
+
before { expect(transaction.request).to receive(:env).and_return(nil) }
|
610
|
+
|
611
|
+
it { should eq nil }
|
612
|
+
end
|
613
|
+
|
602
614
|
context "when queue start is nil" do
|
603
615
|
it { should eq nil }
|
604
616
|
end
|
@@ -616,8 +628,14 @@ describe Appsignal::Transaction do
|
|
616
628
|
subject { transaction.send(:http_queue_start) }
|
617
629
|
|
618
630
|
shared_examples "http queue start" do
|
631
|
+
context "when request is nil" do
|
632
|
+
let(:request) { nil }
|
633
|
+
|
634
|
+
it { should be_nil }
|
635
|
+
end
|
636
|
+
|
619
637
|
context "when env is nil" do
|
620
|
-
before { transaction.request.
|
638
|
+
before { expect(transaction.request).to receive(:env).and_return(nil) }
|
621
639
|
|
622
640
|
it { should be_nil }
|
623
641
|
end
|
@@ -751,8 +769,16 @@ describe Appsignal::Transaction do
|
|
751
769
|
|
752
770
|
subject { transaction.send(:sanitized_environment) }
|
753
771
|
|
772
|
+
context "when request is nil" do
|
773
|
+
let(:request) { nil }
|
774
|
+
|
775
|
+
it "returns nil" do
|
776
|
+
expect(subject).to be_nil
|
777
|
+
end
|
778
|
+
end
|
779
|
+
|
754
780
|
context "when env is nil" do
|
755
|
-
before { transaction.request.
|
781
|
+
before { expect(transaction.request).to receive(:env).and_return(nil) }
|
756
782
|
|
757
783
|
it { should be_nil }
|
758
784
|
end
|
@@ -773,14 +799,22 @@ describe Appsignal::Transaction do
|
|
773
799
|
describe '#sanitized_session_data' do
|
774
800
|
subject { transaction.send(:sanitized_session_data) }
|
775
801
|
|
776
|
-
context "when
|
777
|
-
|
802
|
+
context "when request is nil" do
|
803
|
+
let(:request) { nil }
|
804
|
+
|
805
|
+
it "returns nil" do
|
806
|
+
expect(subject).to be_nil
|
807
|
+
end
|
808
|
+
end
|
809
|
+
|
810
|
+
context "when session is nil" do
|
811
|
+
before { expect(transaction.request).to receive(:session).and_return(nil) }
|
778
812
|
|
779
813
|
it { should be_nil }
|
780
814
|
end
|
781
815
|
|
782
|
-
context "when
|
783
|
-
before { transaction.request.
|
816
|
+
context "when session is empty" do
|
817
|
+
before { expect(transaction.request).to receive(:session).and_return({}) }
|
784
818
|
|
785
819
|
it { should eq({}) }
|
786
820
|
end
|
@@ -844,8 +878,14 @@ describe Appsignal::Transaction do
|
|
844
878
|
describe "#metadata" do
|
845
879
|
subject { transaction.send(:metadata) }
|
846
880
|
|
881
|
+
context "when request is nil" do
|
882
|
+
let(:request) { nil }
|
883
|
+
|
884
|
+
it { should be_nil }
|
885
|
+
end
|
886
|
+
|
847
887
|
context "when env is nil" do
|
848
|
-
before { transaction.request.
|
888
|
+
before { expect(transaction.request).to receive(:env).and_return(nil) }
|
849
889
|
|
850
890
|
it { should be_nil }
|
851
891
|
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: 2.0.
|
4
|
+
version: 2.0.5.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -327,12 +327,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
327
327
|
version: '1.9'
|
328
328
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
329
329
|
requirements:
|
330
|
-
- - "
|
330
|
+
- - ">"
|
331
331
|
- !ruby/object:Gem::Version
|
332
|
-
version:
|
332
|
+
version: 1.3.1
|
333
333
|
requirements: []
|
334
334
|
rubyforge_project:
|
335
|
-
rubygems_version: 2.5
|
335
|
+
rubygems_version: 2.4.5
|
336
336
|
signing_key:
|
337
337
|
specification_version: 4
|
338
338
|
summary: Logs performance and exception data from your app to appsignal.com
|
@@ -432,3 +432,4 @@ test_files:
|
|
432
432
|
- spec/support/project_fixture/log/.gitkeep
|
433
433
|
- spec/support/rails/my_app.rb
|
434
434
|
- spec/support/stubs/delayed_job.rb
|
435
|
+
has_rdoc:
|