appsignal 1.3.0.beta.2 → 1.3.0.beta.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b276d2585236d4d72a0c53a1da223be380146aaf
4
- data.tar.gz: 44741c7c13c439ce8014cea0bdb4ab87f7da783e
3
+ metadata.gz: e73535489669f40b80aa41c5f757e02779f0156f
4
+ data.tar.gz: 24d7abe5c05024103e5654b59a2a056625e131be
5
5
  SHA512:
6
- metadata.gz: adc49f118d2b5db67c689a54e84cae302cddc6af3e8fe67f3505ccf6eb9a8b65feb4e3bda838f6acc5b3185bc063945adb605237b1522adbb4259cb2d978b4f4
7
- data.tar.gz: 56e23266468429ef29cca3252b27ed371a6a3780964bc3f059f05629c884b3ecdfdd2730709e7b8d7f4fe7b8cf53c66cc544650907e2636bcdca707285fc78b8
6
+ metadata.gz: c48a0f36c7ba4bc2481e215b7a60b363528bfafa10c7e1a07094ac147319fca0a7ca2dcaac49b44258021baaa26cc2816fe13a59b2c40b9b232b104bbad851cc
7
+ data.tar.gz: 3edface3054bd2eaf48fd5d9b9fed014b68e4c3cb61ebd0423c44619f723f3a2858cb6d09b0a807c13655dd05bf72177af165e66d035491f1c496e823f2331a6
@@ -11,6 +11,7 @@
11
11
  * `Appsignal.instrument` helper to easily instrument blocks of code
12
12
  * `record_event` method to instrument events without a start hook
13
13
  * `send_params` is now configurable via the environment
14
+ * Add DataMapper integration
14
15
 
15
16
  # 1.2.5
16
17
  * Bugfix in CPU utilization calculation for host metrics
data/Rakefile CHANGED
@@ -53,10 +53,8 @@ task :publish do
53
53
  puts `git commit -am 'Bump to #{version} [ci skip]'`
54
54
  puts "# Creating tag #{version}"
55
55
  puts `git tag #{version}`
56
- puts `git push public #{version}`
57
- puts `git push private #{version}`
58
- puts `git push public #{branch}`
59
- puts `git push private #{branch}`
56
+ puts `git push origin #{version}`
57
+ puts `git push origin #{branch}`
60
58
  rescue
61
59
  raise "Tag: '#{version}' already exists"
62
60
  end
@@ -97,3 +97,4 @@ require 'appsignal/hooks/shoryuken'
97
97
  require 'appsignal/hooks/sidekiq'
98
98
  require 'appsignal/hooks/unicorn'
99
99
  require 'appsignal/hooks/mongo_ruby_driver'
100
+ require 'appsignal/hooks/data_mapper'
@@ -0,0 +1,17 @@
1
+ module Appsignal
2
+ class Hooks
3
+ class DataMapperHook < Appsignal::Hooks::Hook
4
+ register :data_mapper
5
+
6
+ def dependencies_present?
7
+ defined?(::DataMapper) &&
8
+ defined?(::DataObjects::Connection)
9
+ end
10
+
11
+ def install
12
+ require 'appsignal/integrations/data_mapper'
13
+ ::DataObjects::Connection.send(:include, Appsignal::Hooks::DataMapperLogListener)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  namespace :appsignal do
2
2
  task :deploy do
3
- env = fetch(:stage, fetch(:rails_env, fetch(:rack_env, 'production')))
3
+ env = fetch(:appsignal_env, fetch(:stage, fetch(:rails_env, fetch(:rack_env, 'production'))))
4
4
  user = ENV['USER'] || ENV['USERNAME']
5
5
  revision = fetch(:appsignal_revision, fetch(:current_revision))
6
6
 
@@ -0,0 +1,31 @@
1
+ module Appsignal
2
+ class Hooks
3
+ module DataMapperLogListener
4
+
5
+ def log(message)
6
+ # Attempt to find the scheme used for this message
7
+ scheme = instance_variable_get(:@uri).scheme
8
+
9
+ # If scheme is SQL-like, try to sanitize it, otherwise clear the body
10
+ if %w(sqlite sqlite3 mysql postgres).include?(scheme)
11
+ body_content = message.query
12
+ body_format = Appsignal::EventFormatter::SQL_BODY_FORMAT
13
+ else
14
+ body_content = ""
15
+ body_format = Appsignal::EventFormatter::DEFAULT
16
+ end
17
+
18
+ # Record event
19
+ Appsignal::Transaction.current.record_event(
20
+ 'query.data_mapper',
21
+ 'DataMapper Query',
22
+ body_content,
23
+ message.duration,
24
+ body_format
25
+ )
26
+ super
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '1.3.0.beta.2'
4
+ VERSION = '1.3.0.beta.3'
5
5
  end
@@ -68,13 +68,13 @@ if capistrano3_present?
68
68
  )
69
69
  end
70
70
 
71
- context "when rack_env is used instead of rails_env" do
71
+ context "when rack_env is the only env set" do
72
72
  before do
73
73
  @capistrano_config.delete(:rails_env)
74
74
  @capistrano_config.set(:rack_env, 'rack_production')
75
75
  end
76
76
 
77
- it "should be instantiated with the right params" do
77
+ it "should be instantiated with the rack env" do
78
78
  Appsignal::Config.should_receive(:new).with(
79
79
  project_fixture_path,
80
80
  'rack_production',
@@ -84,13 +84,13 @@ if capistrano3_present?
84
84
  end
85
85
  end
86
86
 
87
- context "when stage is used instead of rack_env / rails_env" do
87
+ context "when stage is set" do
88
88
  before do
89
- @capistrano_config.delete(:rails_env)
89
+ @capistrano_config.set(:rack_env, 'rack_production')
90
90
  @capistrano_config.set(:stage, 'stage_production')
91
91
  end
92
92
 
93
- it "should be instantiated with the right params" do
93
+ it "should prefer the stage rather than rails_env and rack_env" do
94
94
  Appsignal::Config.should_receive(:new).with(
95
95
  project_fixture_path,
96
96
  'stage_production',
@@ -99,12 +99,30 @@ if capistrano3_present?
99
99
  )
100
100
  end
101
101
  end
102
+
103
+ context "when appsignal_env is set" do
104
+ before do
105
+ @capistrano_config.set(:rack_env, 'rack_production')
106
+ @capistrano_config.set(:stage, 'stage_production')
107
+ @capistrano_config.set(:appsignal_env, 'appsignal_production')
108
+ end
109
+
110
+ it "should prefer the appsignal_env rather than stage, rails_env and rack_env" do
111
+ Appsignal::Config.should_receive(:new).with(
112
+ project_fixture_path,
113
+ 'appsignal_production',
114
+ {:name => 'AppName'},
115
+ kind_of(Logger)
116
+ )
117
+ end
118
+ end
102
119
  end
103
120
 
104
121
  after do
105
122
  invoke('appsignal:deploy')
106
123
  @capistrano_config.delete(:stage)
107
124
  @capistrano_config.delete(:rack_env)
125
+ @capistrano_config.delete(:appsignal_env)
108
126
  end
109
127
  end
110
128
 
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe Appsignal::Hooks::DataMapperHook do
4
+ context "with datamapper" do
5
+ before :all do
6
+ module DataMapper
7
+ end
8
+ module DataObjects
9
+ class Connection
10
+ end
11
+ end
12
+ Appsignal::Hooks::DataMapperHook.new.install
13
+ end
14
+
15
+ after :all do
16
+ Object.send(:remove_const, :DataMapper)
17
+ Object.send(:remove_const, :DataObjects)
18
+ end
19
+
20
+ its(:dependencies_present?) { should be_true }
21
+
22
+ it "should install the listener" do
23
+ expect(::DataObjects::Connection).to receive(:include)
24
+ .with(Appsignal::Hooks::DataMapperLogListener)
25
+
26
+ Appsignal::Hooks::DataMapperHook.new.install
27
+ end
28
+ end
29
+
30
+ context "without datamapper" do
31
+ its(:dependencies_present?) { should be_false }
32
+ end
33
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+ require 'appsignal/integrations/data_mapper'
3
+
4
+ describe Appsignal::Hooks::DataMapperLogListener do
5
+
6
+ module DataMapperLog
7
+ def log(message)
8
+ end
9
+ end
10
+
11
+ class DataMapperTestClass
12
+ include DataMapperLog
13
+ include Appsignal::Hooks::DataMapperLogListener
14
+
15
+ def initialize(uri)
16
+ @uri = uri
17
+ end
18
+ end
19
+
20
+ describe "#log" do
21
+ let!(:data_mapper_class) { DataMapperTestClass.new(uri) }
22
+ let(:uri) { double(:scheme => 'mysql') }
23
+ let(:transaction) { double }
24
+ let(:message) do
25
+ double(
26
+ :query => "SELECT * from users",
27
+ :duration => 100
28
+ )
29
+ end
30
+
31
+ before do
32
+ Appsignal::Transaction.stub(:current) { transaction }
33
+ end
34
+
35
+ it "should record the log entry in an event" do
36
+ expect( transaction ).to receive(:record_event).with(
37
+ 'query.data_mapper',
38
+ 'DataMapper Query',
39
+ "SELECT * from users",
40
+ 100,
41
+ Appsignal::EventFormatter::SQL_BODY_FORMAT
42
+ )
43
+ end
44
+
45
+ context "when scheme is not sql-like" do
46
+ let(:uri) { double(:scheme => 'mongodb') }
47
+
48
+ it "should record the log entry in an event without body" do
49
+ expect( transaction ).to receive(:record_event).with(
50
+ 'query.data_mapper',
51
+ 'DataMapper Query',
52
+ "",
53
+ 100,
54
+ Appsignal::EventFormatter::DEFAULT
55
+ )
56
+ end
57
+ end
58
+
59
+ after { data_mapper_class.log(message) }
60
+ end
61
+ end
@@ -43,9 +43,7 @@ describe Appsignal::Minutely do
43
43
  describe Appsignal::Minutely::GCProbe do
44
44
  describe "#call" do
45
45
  it "should collect GC metrics" do
46
- expect(Appsignal).to receive(:set_process_gauge).with('gc.count', kind_of(Integer)).once
47
- expect(Appsignal).to receive(:set_process_gauge).with('gc.heap_allocated_pages', kind_of(Integer)).once
48
- expect(Appsignal).to receive(:set_process_gauge).at_least(10).times
46
+ expect(Appsignal).to receive(:set_process_gauge).at_least(8).times
49
47
 
50
48
  Appsignal::Minutely::GCProbe.new.call
51
49
  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: 1.3.0.beta.2
4
+ version: 1.3.0.beta.3
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: 2016-08-16 00:00:00.000000000 Z
12
+ date: 2016-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -166,6 +166,7 @@ files:
166
166
  - lib/appsignal/extension.rb
167
167
  - lib/appsignal/hooks.rb
168
168
  - lib/appsignal/hooks/celluloid.rb
169
+ - lib/appsignal/hooks/data_mapper.rb
169
170
  - lib/appsignal/hooks/delayed_job.rb
170
171
  - lib/appsignal/hooks/mongo_ruby_driver.rb
171
172
  - lib/appsignal/hooks/net_http.rb
@@ -179,6 +180,7 @@ files:
179
180
  - lib/appsignal/hooks/unicorn.rb
180
181
  - lib/appsignal/integrations/capistrano/appsignal.cap
181
182
  - lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
183
+ - lib/appsignal/integrations/data_mapper.rb
182
184
  - lib/appsignal/integrations/delayed_job_plugin.rb
183
185
  - lib/appsignal/integrations/grape.rb
184
186
  - lib/appsignal/integrations/mongo_ruby_driver.rb
@@ -232,6 +234,7 @@ files:
232
234
  - spec/lib/appsignal/event_formatter_spec.rb
233
235
  - spec/lib/appsignal/extension_spec.rb
234
236
  - spec/lib/appsignal/hooks/celluloid_spec.rb
237
+ - spec/lib/appsignal/hooks/data_mapper_spec.rb
235
238
  - spec/lib/appsignal/hooks/delayed_job_spec.rb
236
239
  - spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
237
240
  - spec/lib/appsignal/hooks/net_http_spec.rb
@@ -244,6 +247,7 @@ files:
244
247
  - spec/lib/appsignal/hooks/sidekiq_spec.rb
245
248
  - spec/lib/appsignal/hooks/unicorn_spec.rb
246
249
  - spec/lib/appsignal/hooks_spec.rb
250
+ - spec/lib/appsignal/integrations/data_mapper_spec.rb
247
251
  - spec/lib/appsignal/integrations/grape_spec.rb
248
252
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
249
253
  - spec/lib/appsignal/integrations/object_spec.rb
@@ -308,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
312
  version: 1.3.1
309
313
  requirements: []
310
314
  rubyforge_project:
311
- rubygems_version: 2.4.5
315
+ rubygems_version: 2.5.1
312
316
  signing_key:
313
317
  specification_version: 4
314
318
  summary: Logs performance and exception data from your app to appsignal.com
@@ -331,6 +335,7 @@ test_files:
331
335
  - spec/lib/appsignal/event_formatter_spec.rb
332
336
  - spec/lib/appsignal/extension_spec.rb
333
337
  - spec/lib/appsignal/hooks/celluloid_spec.rb
338
+ - spec/lib/appsignal/hooks/data_mapper_spec.rb
334
339
  - spec/lib/appsignal/hooks/delayed_job_spec.rb
335
340
  - spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb
336
341
  - spec/lib/appsignal/hooks/net_http_spec.rb
@@ -343,6 +348,7 @@ test_files:
343
348
  - spec/lib/appsignal/hooks/sidekiq_spec.rb
344
349
  - spec/lib/appsignal/hooks/unicorn_spec.rb
345
350
  - spec/lib/appsignal/hooks_spec.rb
351
+ - spec/lib/appsignal/integrations/data_mapper_spec.rb
346
352
  - spec/lib/appsignal/integrations/grape_spec.rb
347
353
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
348
354
  - spec/lib/appsignal/integrations/object_spec.rb
@@ -386,4 +392,3 @@ test_files:
386
392
  - spec/support/project_fixture/log/.gitkeep
387
393
  - spec/support/rails/my_app.rb
388
394
  - spec/support/stubs/delayed_job.rb
389
- has_rdoc: