appsignal 0.11.1 → 0.11.2

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: d41abe0ea106adaa95e6273e1187136769252aaf
4
- data.tar.gz: 3c1e7c0345cdd1e32eff0d33493025ac13b4e24f
3
+ metadata.gz: 690d32a5f831ef2de09053cbbc8c0a1168562934
4
+ data.tar.gz: f48dd5a3f29d4a1c274a45ade89ca40a45718885
5
5
  SHA512:
6
- metadata.gz: 1d3dc0a5722caa2109cd7b15ef2bf9929df3e1927b6d2e16f17de79d27d01724d62f8266e4274a6dc8d4b9ea0d8bbf55786ad12f1d19dceaa4ebfde5d852f80f
7
- data.tar.gz: 28001d15fced01dd048fd66dada12216ed8044cae66b0d7354964a1fcf6a467341a37003edb03b216af13a505052590d8842d1c3419eb24fec7870cf5fb8adfb
6
+ metadata.gz: 4001537ce6a8090f5f0c5793b04d494b1ecaee02a2ce46d7672e430cf3e3dc3efe4755865fc0e790c0ec1d7ac6f0e1180a950ddecaf74e68b5d58735fe1d7ff4
7
+ data.tar.gz: c57f68c79f10dd3cbdf9ab98028dd288dda2503f4412f15c3c0353f62cce606992672170368998e6ffde58d19099a7d37b4e0b9a45d3b57fea835f01acb8adfa
@@ -1,3 +1,6 @@
1
+ # 0.11.2
2
+ * If APP_REVISION environment variable is set, send it with the log entry.
3
+
1
4
  # 0.11.1
2
5
  * Allow a custom request_class and params_method on Rack instrumentation
3
6
  * Loop through env methods instead of env
@@ -0,0 +1,75 @@
1
+ require 'appsignal'
2
+ require 'benchmark'
3
+
4
+ class ::Appsignal::Event::ActiveRecordEvent
5
+ def connection_config; {:adapter => 'mysql'}; end
6
+ end
7
+
8
+ namespace :benchmark do
9
+ task :all => [:run_inactive, :run_active] do
10
+ end
11
+
12
+ task :run_inactive do
13
+ puts 'Running with appsignal off'
14
+ ENV['APPSIGNAL_PUSH_API_KEY'] = nil
15
+ subscriber = ActiveSupport::Notifications.subscribe do |*args|
16
+ # Add a subscriber so we can track the overhead of just appsignal
17
+ end
18
+ run_benchmark
19
+ ActiveSupport::Notifications.unsubscribe(subscriber)
20
+ end
21
+
22
+ task :run_active do
23
+ puts 'Running with appsignal on'
24
+ ENV['APPSIGNAL_PUSH_API_KEY'] = 'something'
25
+ run_benchmark
26
+ end
27
+ end
28
+
29
+ def run_benchmark
30
+ total_objects = ObjectSpace.count_objects[:TOTAL]
31
+ puts "Initializing, currently #{total_objects} objects"
32
+ Appsignal.config = Appsignal::Config.new('', 'production')
33
+ Appsignal.start
34
+ puts "Appsignal #{Appsignal.active? ? 'active' : 'not active'}"
35
+
36
+ puts 'Running 10_000 normal transactions'
37
+ puts(Benchmark.measure do
38
+ 10_000.times do |i|
39
+ Appsignal::Transaction.create("transaction_#{i}", {})
40
+
41
+ ActiveSupport::Notifications.instrument('sql.active_record', :sql => 'SELECT `users`.* FROM `users` WHERE `users`.`id` = ?')
42
+ 10.times do
43
+ ActiveSupport::Notifications.instrument('sql.active_record', :sql => 'SELECT `todos`.* FROM `todos` WHERE `todos`.`id` = ?')
44
+ end
45
+
46
+ ActiveSupport::Notifications.instrument('render_template.action_view', :identifier => 'app/views/home/show.html.erb') do
47
+ 5.times do
48
+ ActiveSupport::Notifications.instrument('render_partial.action_view', :identifier => 'app/views/home/_piece.html.erb') do
49
+ 3.times do
50
+ ActiveSupport::Notifications.instrument('cache.read')
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ ActiveSupport::Notifications.instrument(
57
+ 'process_action.action_controller',
58
+ :controller => 'HomeController',
59
+ :action => 'show',
60
+ :params => {:id => 1}
61
+ )
62
+
63
+ Appsignal::Transaction.complete_current!
64
+ end
65
+ end)
66
+
67
+ if Appsignal.active?
68
+ puts "Running aggregator post_processed_queue! for #{Appsignal.agent.aggregator.queue.length} transactions"
69
+ puts(Benchmark.measure do
70
+ Appsignal.agent.aggregator.post_processed_queue!.to_json
71
+ end)
72
+ end
73
+
74
+ puts "Done, currently #{ObjectSpace.count_objects[:TOTAL] - total_objects} objects created"
75
+ end
@@ -4,7 +4,7 @@ module Appsignal
4
4
  AGGREGATOR_LIMIT = 5 # Five minutes with a sleep time of 60 seconds
5
5
 
6
6
  attr_accessor :aggregator, :thread, :master_pid, :pid, :active, :sleep_time,
7
- :transmitter, :subscriber, :paused, :aggregator_queue
7
+ :transmitter, :subscriber, :paused, :aggregator_queue, :revision
8
8
 
9
9
  def initialize
10
10
  return unless Appsignal.config.active?
@@ -31,7 +31,8 @@ module Appsignal
31
31
 
32
32
  def start_thread
33
33
  Appsignal.logger.debug('Starting agent thread')
34
- @thread = Thread.new do
34
+ @revision = ENV['APP_REVISION']
35
+ @thread = Thread.new do
35
36
  begin
36
37
  sleep(rand(sleep_time))
37
38
  loop do
@@ -28,7 +28,8 @@ module Appsignal
28
28
  :kind => kind,
29
29
  :time => time,
30
30
  :environment => sanitized_environment,
31
- :session_data => sanitized_session_data
31
+ :session_data => sanitized_session_data,
32
+ :revision => Appsignal.agent.revision
32
33
  },
33
34
  :failed => exception?
34
35
  }
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.11.1'
2
+ VERSION = '0.11.2'
3
3
  end
@@ -98,6 +98,19 @@ describe Appsignal::Agent do
98
98
  sleep 1
99
99
  end
100
100
  end
101
+
102
+ context "with revision" do
103
+ around do |sample|
104
+ ENV['APP_REVISION'] = 'abc'
105
+ sample.run
106
+ ENV['APP_REVISION'] = nil
107
+ end
108
+
109
+ it "should set the revision" do
110
+ subject.start_thread
111
+ expect( subject.revision ).to eql 'abc'
112
+ end
113
+ end
101
114
  end
102
115
 
103
116
  describe "#restart_thread" do
@@ -27,6 +27,7 @@ describe Appsignal::Transaction::Formatter do
27
27
  :kind => "http_request",
28
28
  :path => "/foo",
29
29
  :session_data => {},
30
+ :revision => nil,
30
31
  :time => 1389783600.0,
31
32
  } }
32
33
  its([:events]) { should be_nil }
@@ -44,6 +45,17 @@ describe Appsignal::Transaction::Formatter do
44
45
  end
45
46
  end
46
47
 
48
+ context "when the APP_REVISION environment variable is present" do
49
+ let(:transaction) { regular_transaction }
50
+ before do
51
+ Appsignal.agent.stub(:revision => 'foo')
52
+ end
53
+
54
+ it "should store the APP_REVISION" do
55
+ subject.to_hash[:log_entry][:revision].should == 'foo'
56
+ end
57
+ end
58
+
47
59
  context "with an exception request" do
48
60
  let(:transaction) { transaction_with_exception }
49
61
 
@@ -107,6 +119,7 @@ describe Appsignal::Transaction::Formatter do
107
119
  :kind => "http_request",
108
120
  :path => "/blog",
109
121
  :session_data => {},
122
+ :revision => nil,
110
123
  :time => 1389783600.0,
111
124
  :db_runtime => 500,
112
125
  :view_runtime => 500,
@@ -171,6 +184,7 @@ describe Appsignal::Transaction::Formatter do
171
184
  :kind => "background_job",
172
185
  :path => "/foo",
173
186
  :session_data => {},
187
+ :revision => nil,
174
188
  :time => 1389783600.0,
175
189
  } }
176
190
  its([:failed]) { should be_false }
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.11.1
4
+ version: 0.11.2
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-12-15 00:00:00.000000000 Z
15
+ date: 2015-01-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack
@@ -129,6 +129,7 @@ files:
129
129
  - README.md
130
130
  - Rakefile
131
131
  - appsignal.gemspec
132
+ - benchmark.rake
132
133
  - bin/appsignal
133
134
  - gemfiles/capistrano2.gemfile
134
135
  - gemfiles/capistrano3.gemfile