appsignal 2.0.6 → 2.1.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71dba256de2f6e7c3fef2638fe3ff22ac1867734
4
- data.tar.gz: 19afcda8d5855a43912aee21e4953744990ae96f
3
+ metadata.gz: 20f58e406be6333a02b4e9d9c71b27f39012406d
4
+ data.tar.gz: 66bb80adf03714c807bfdcc8b08718a750d2aedb
5
5
  SHA512:
6
- metadata.gz: 4abc56838105533b0384f14889fc80af1898bc4744b60f4d55ea7524cfccfaf1052bb9e1c88da98c8840b4f72956ec1e2c854af9a845d6d61e14121183dfb8e1
7
- data.tar.gz: fe65746d9243bfc5393519b1d23c0beeefc7c0ed53588043a3b95b0c16a66a2372a2472775d4cd9ba0dc60395cecf32c72c28457ea664ee33dce59c9e659d2e4
6
+ metadata.gz: e8e6951d7689466dbf33dcfba1e17f9bab6d17cfb723079f8a306b57c7508d77f1eb42ec5e00a6c5ac945c38a8edaa253091b14af9abfbe19406a85b9360813f
7
+ data.tar.gz: 410d73ddc69a17245fa52f8c9298ff21a7fefdd99edbd306cdd8cdb9917834a7b3b7c740e4827f59c233c134c41665b360d907c3c8ed40a0f2575a8049511a83
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .sass-cache
4
4
  capybara-*.html
5
5
  *.log
6
- /doc
7
6
  /.bundle
8
7
  /vendor/bundle
9
8
  /tmp/*
@@ -1,10 +1,5 @@
1
- # 2.0.6
2
- * Fix `Appsignal::Transaction#record_event` method call. PR #240
3
-
4
- # 2.0.5
5
- * Improved logging for agent connection issues. Commit
6
- cdf9d3286d704e22473eb901c839cab4fab45a6f
7
- * Handle nil request/environments in transactions. PR #231
1
+ # 2.1.0
2
+ * Add support for musl libc
8
3
 
9
4
  # 2.0.4
10
5
  * Use consistent log format for both file and STDOUT logs. PR #203
data/Rakefile CHANGED
@@ -57,7 +57,7 @@ task :publish do
57
57
  puts "# Creating tag #{version}"
58
58
  puts `git tag #{version}`
59
59
  puts `git push origin #{version}`
60
- puts `git push origin #{branch}`
60
+ puts `git push origin #{current_branch}`
61
61
  rescue
62
62
  raise "Tag: '#{version}' already exists"
63
63
  end
@@ -75,14 +75,8 @@ task :publish do
75
75
  @version ||= 'v' << gem_version
76
76
  end
77
77
 
78
- def branch
79
- if gem_version.include?('alpha') ||
80
- gem_version.include?('beta') ||
81
- gem_version.include?('rc')
82
- 'develop'
83
- else
84
- 'master'
85
- end
78
+ def current_branch
79
+ `git rev-parse --abbrev-ref HEAD`.chomp
86
80
  end
87
81
 
88
82
  def git_status_to_array(changes)
@@ -1,18 +1,6 @@
1
1
  ---
2
- version: a1cb32f
2
+ version: 21f0b26
3
3
  triples:
4
4
  x86_64-linux:
5
- checksum: 8905166cbd29ad3038d013438781118bb2fa4ea3fef2e7abfe3a4a4d90d7b40c
6
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-x86_64-linux-all-static.tar.gz
7
- i686-linux:
8
- checksum: 0ae5f06cf9fd516c7a33cbe29a78016b3b419717870d5fba793345fecb696950
9
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-i686-linux-all-static.tar.gz
10
- x86-linux:
11
- checksum: 0ae5f06cf9fd516c7a33cbe29a78016b3b419717870d5fba793345fecb696950
12
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-i686-linux-all-static.tar.gz
13
- x86_64-darwin:
14
- checksum: 750e49e56c2024c82adc64471feb855ab7a5caff79cb37978a83e11e31a023ce
15
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-x86_64-darwin-all-static.tar.gz
16
- universal-darwin:
17
- checksum: 750e49e56c2024c82adc64471feb855ab7a5caff79cb37978a83e11e31a023ce
18
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/a1cb32f/appsignal-x86_64-darwin-all-static.tar.gz
5
+ checksum: e965ea8d4a01ea2caf9b50a6520c2f2385a00c00bc5d259079f93baddca0b28c
6
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/21f0b26/appsignal-x86_64-linux-all-static.tar.gz
@@ -4,7 +4,3 @@ gem 'rails', '~> 4.2.0'
4
4
  gem 'mime-types', '~> 2.6'
5
5
 
6
6
  gemspec :path => '../'
7
-
8
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.1.0")
9
- gem 'nokogiri', '~> 1.6.0'
10
- end
@@ -6,7 +6,3 @@ gem 'sinatra'
6
6
  gem 'mime-types', '~> 2.6'
7
7
 
8
8
  gemspec :path => '../'
9
-
10
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.1.0")
11
- gem 'nokogiri', '~> 1.6.0'
12
- end
@@ -10,7 +10,7 @@ module Appsignal
10
10
  puts "Sending demonstration sample data..."
11
11
  if Appsignal::Demo.transmit
12
12
  puts "Demonstration sample data sent!"
13
- puts "It may take about a minute for the data to appear on https://appsignal.com/accounts"
13
+ puts "It may take about a minute for the data to appear on AppSignal.com/accounts"
14
14
  else
15
15
  puts "Error: Unable to start the AppSignal agent and send data to AppSignal.com"
16
16
  puts "Please use `appsignal diagnose` to debug your configuration."
@@ -204,7 +204,7 @@ module Appsignal
204
204
  puts " Sending example data to AppSignal..."
205
205
  if Appsignal::Demo.transmit
206
206
  puts " Example data sent!"
207
- puts " It may take about a minute for the data to appear on https://appsignal.com/accounts"
207
+ puts " It may take about a minute for the data to appear on AppSignal.com/accounts"
208
208
  puts
209
209
  puts " Please return to your browser and follow the instructions."
210
210
  else
@@ -213,8 +213,7 @@ module Appsignal
213
213
  title || BLANK,
214
214
  body || BLANK,
215
215
  duration,
216
- body_format || Appsignal::EventFormatter::DEFAULT,
217
- self.class.garbage_collection_profiler.total_time
216
+ body_format || Appsignal::EventFormatter::DEFAULT
218
217
  )
219
218
  end
220
219
 
@@ -239,40 +238,23 @@ module Appsignal
239
238
 
240
239
  protected
241
240
 
242
- # Returns calculated background queue start time in milliseconds, based on
243
- # environment values.
244
- #
245
- # @return [nil] if no {#environment} is present.
246
- # @return [nil] if there is no `:queue_start` in the {#environment}.
247
- # @return [Integer]
248
241
  def background_queue_start
249
- env = environment
250
- return unless env
251
- queue_start = env[:queue_start]
252
- return unless queue_start
253
-
242
+ return unless request.env
243
+ return unless queue_start = request.env[:queue_start]
254
244
  (queue_start.to_f * 1000.0).to_i
255
245
  end
256
246
 
257
- # Returns HTTP queue start time in milliseconds.
258
- #
259
- # @return [nil] if no queue start time is found.
260
- # @return [nil] if begin time is too low to be plausible.
261
- # @return [Integer] queue start in milliseconds.
262
247
  def http_queue_start
263
- env = environment
264
- return unless env
265
- env_var = env["HTTP_X_QUEUE_START".freeze] || env["HTTP_X_REQUEST_START".freeze]
266
- return unless env_var
267
- cleaned_value = env_var.tr("^0-9".freeze, "".freeze)
248
+ return unless request.env
249
+ return unless env_var = request.env['HTTP_X_QUEUE_START'.freeze] || request.env['HTTP_X_REQUEST_START'.freeze]
250
+ cleaned_value = env_var.tr('^0-9'.freeze, ''.freeze)
268
251
  return if cleaned_value.empty?
269
-
270
252
  value = cleaned_value.to_i
271
253
  if value > 4_102_441_200_000
272
- # Value is in microseconds. Transform to milliseconds.
254
+ # Value is in microseconds
273
255
  value / 1_000
274
256
  elsif value < 946_681_200_000
275
- # Value is too low to be plausible
257
+ # Value is to low to be plausible
276
258
  nil
277
259
  else
278
260
  # Value is in milliseconds
@@ -301,62 +283,24 @@ module Appsignal
301
283
  Appsignal::Utils::ParamsSanitizer.sanitize params, options
302
284
  end
303
285
 
304
- # Returns sanitized environment for a transaction.
305
- #
306
- # The environment of a transaction can contain a lot of information, not
307
- # all of it useful for debugging.
308
- #
309
- # Only the values from the keys specified in `ENV_METHODS` are returned.
310
- #
311
- # @return [nil] if no environment is present.
312
- # @return [Hash<String, Object>]
313
286
  def sanitized_environment
314
- env = environment
315
- return if env.empty?
316
-
287
+ return unless request.env
317
288
  {}.tap do |out|
318
289
  ENV_METHODS.each do |key|
319
- out[key] = env[key] if env[key]
290
+ out[key] = request.env[key] if request.env[key]
320
291
  end
321
292
  end
322
293
  end
323
294
 
324
- # Returns sanitized session data.
325
- #
326
- # The session data is sanitized by the {Appsignal::Utils::ParamsSanitizer}.
327
- #
328
- # @return [nil] if `:skip_session_data` config is set to `true`.
329
- # @return [nil] if the {#request} object doesn't respond to `#session`.
330
- # @return [nil] if the {#request} session data is `nil`.
331
- # @return [Hash<String, Object>]
332
295
  def sanitized_session_data
333
- return if Appsignal.config[:skip_session_data] ||
334
- !request.respond_to?(:session)
335
- session = request.session
336
- return unless session
337
-
296
+ return if Appsignal.config[:skip_session_data] || !request.respond_to?(:session)
297
+ return unless session = request.session
338
298
  Appsignal::Utils::ParamsSanitizer.sanitize(session.to_hash)
339
299
  end
340
300
 
341
- # Returns metadata from the environment.
342
- #
343
- # @return [nil] if no `:metadata` key is present in the {#environment}.
344
- # @return [Hash<String, Object>]
345
301
  def metadata
346
- environment[:metadata]
347
- end
348
-
349
- # Returns the environment for a transaction.
350
- #
351
- # Returns an empty Hash when the {#request} object doesn't listen to the
352
- # `#env` method or the `#env` is nil.
353
- #
354
- # @return [Hash<String, Object>]
355
- def environment
356
- return {} unless request.respond_to?(:env)
357
- return {} unless request.env
358
-
359
- request.env
302
+ return unless request.env
303
+ request.env[:metadata]
360
304
  end
361
305
 
362
306
  # Only keep tags if they meet the following criteria:
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '2.0.6'
4
+ VERSION = '2.1.0.alpha.1'
5
5
  end
@@ -3,8 +3,9 @@ if DependencyHelper.capistrano3_present?
3
3
  require 'capistrano/deploy'
4
4
  require 'appsignal/capistrano'
5
5
 
6
+ include Capistrano::DSL
7
+
6
8
  describe "Capistrano 3 integration" do
7
- let(:capistrano) { Class.new.extend(Capistrano::DSL) }
8
9
  let(:config) { project_fixture_config }
9
10
  let(:out_stream) { std_stream }
10
11
  let(:output) { out_stream.read }
@@ -25,7 +26,7 @@ if DependencyHelper.capistrano3_present?
25
26
 
26
27
  def run
27
28
  capture_std_streams(out_stream, out_stream) do
28
- capistrano.invoke('appsignal:deploy')
29
+ invoke('appsignal:deploy')
29
30
  end
30
31
  end
31
32
 
@@ -22,7 +22,7 @@ describe Appsignal::Transaction do
22
22
  before { Timecop.freeze(time) }
23
23
  after { Timecop.return }
24
24
 
25
- describe "class methods" do
25
+ context "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)
@@ -466,29 +466,21 @@ describe Appsignal::Transaction do
466
466
 
467
467
  describe "#start_event" do
468
468
  it "should start the event in the extension" do
469
- expect(transaction.ext).to receive(:start_event).with(0).and_call_original
469
+ transaction.ext.should_receive(:start_event)
470
470
 
471
471
  transaction.start_event
472
472
  end
473
473
  end
474
474
 
475
475
  describe "#finish_event" do
476
- let(:fake_gc_time) { 123 }
477
- before do
478
- described_class.garbage_collection_profiler
479
- .should_receive(:total_time)
480
- .at_least(:once)
481
- .and_return(fake_gc_time)
482
- end
483
-
484
476
  it "should finish the event in the extension" do
485
477
  transaction.ext.should_receive(:finish_event).with(
486
478
  'name',
487
479
  'title',
488
480
  'body',
489
481
  1,
490
- fake_gc_time
491
- ).and_call_original
482
+ 0
483
+ )
492
484
 
493
485
  transaction.finish_event(
494
486
  'name',
@@ -504,8 +496,8 @@ describe Appsignal::Transaction do
504
496
  '',
505
497
  '',
506
498
  0,
507
- fake_gc_time
508
- ).and_call_original
499
+ 0
500
+ )
509
501
 
510
502
  transaction.finish_event(
511
503
  'name',
@@ -514,26 +506,25 @@ describe Appsignal::Transaction do
514
506
  nil
515
507
  )
516
508
  end
517
- end
518
509
 
519
- describe "#record_event" do
520
- let(:fake_gc_time) { 123 }
521
- before do
522
- described_class.garbage_collection_profiler
523
- .should_receive(:total_time)
524
- .at_least(:once)
525
- .and_return(fake_gc_time)
510
+ it "should add garbage collection time" do
511
+ allow_any_instance_of(Appsignal::GarbageCollectionProfiler)
512
+ .to receive(:internal_profiler)
513
+ .and_return(FakeGCProfiler.new(0.12345))
514
+
515
+ transaction.finish_event('name', nil, nil, nil)
526
516
  end
517
+ end
527
518
 
519
+ describe "#record_event" do
528
520
  it "should record the event in the extension" do
529
521
  transaction.ext.should_receive(:record_event).with(
530
522
  'name',
531
523
  'title',
532
524
  'body',
533
525
  1000,
534
- 1,
535
- fake_gc_time
536
- ).and_call_original
526
+ 1
527
+ )
537
528
 
538
529
  transaction.record_event(
539
530
  'name',
@@ -550,9 +541,8 @@ describe Appsignal::Transaction do
550
541
  '',
551
542
  '',
552
543
  1000,
553
- 0,
554
- fake_gc_time
555
- ).and_call_original
544
+ 0
545
+ )
556
546
 
557
547
  transaction.record_event(
558
548
  'name',
@@ -609,18 +599,6 @@ describe Appsignal::Transaction do
609
599
  describe "#background_queue_start" do
610
600
  subject { transaction.send(:background_queue_start) }
611
601
 
612
- context "when request is nil" do
613
- let(:request) { nil }
614
-
615
- it { should eq nil }
616
- end
617
-
618
- context "when env is nil" do
619
- before { expect(transaction.request).to receive(:env).and_return(nil) }
620
-
621
- it { should eq nil }
622
- end
623
-
624
602
  context "when queue start is nil" do
625
603
  it { should eq nil }
626
604
  end
@@ -638,14 +616,8 @@ describe Appsignal::Transaction do
638
616
  subject { transaction.send(:http_queue_start) }
639
617
 
640
618
  shared_examples "http queue start" do
641
- context "when request is nil" do
642
- let(:request) { nil }
643
-
644
- it { should be_nil }
645
- end
646
-
647
619
  context "when env is nil" do
648
- before { expect(transaction.request).to receive(:env).and_return(nil) }
620
+ before { transaction.request.stub(:env => nil) }
649
621
 
650
622
  it { should be_nil }
651
623
  end
@@ -779,16 +751,8 @@ describe Appsignal::Transaction do
779
751
 
780
752
  subject { transaction.send(:sanitized_environment) }
781
753
 
782
- context "when request is nil" do
783
- let(:request) { nil }
784
-
785
- it "returns nil" do
786
- expect(subject).to be_nil
787
- end
788
- end
789
-
790
754
  context "when env is nil" do
791
- before { expect(transaction.request).to receive(:env).and_return(nil) }
755
+ before { transaction.request.stub(:env => nil) }
792
756
 
793
757
  it { should be_nil }
794
758
  end
@@ -809,22 +773,14 @@ describe Appsignal::Transaction do
809
773
  describe '#sanitized_session_data' do
810
774
  subject { transaction.send(:sanitized_session_data) }
811
775
 
812
- context "when request is nil" do
813
- let(:request) { nil }
814
-
815
- it "returns nil" do
816
- expect(subject).to be_nil
817
- end
818
- end
819
-
820
- context "when session is nil" do
821
- before { expect(transaction.request).to receive(:session).and_return(nil) }
776
+ context "when env is nil" do
777
+ before { transaction.request.stub(:session => nil) }
822
778
 
823
779
  it { should be_nil }
824
780
  end
825
781
 
826
- context "when session is empty" do
827
- before { expect(transaction.request).to receive(:session).and_return({}) }
782
+ context "when env is empty" do
783
+ before { transaction.request.stub(:session => {}) }
828
784
 
829
785
  it { should eq({}) }
830
786
  end
@@ -888,14 +844,8 @@ describe Appsignal::Transaction do
888
844
  describe "#metadata" do
889
845
  subject { transaction.send(:metadata) }
890
846
 
891
- context "when request is nil" do
892
- let(:request) { nil }
893
-
894
- it { should be_nil }
895
- end
896
-
897
847
  context "when env is nil" do
898
- before { expect(transaction.request).to receive(:env).and_return(nil) }
848
+ before { transaction.request.stub(:env => nil) }
899
849
 
900
850
  it { should be_nil }
901
851
  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.6
4
+ version: 2.1.0.alpha.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: 2017-01-27 00:00:00.000000000 Z
12
+ date: 2016-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -327,9 +327,9 @@ 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: '0'
332
+ version: 1.3.1
333
333
  requirements: []
334
334
  rubyforge_project:
335
335
  rubygems_version: 2.5.2