appsignal 0.11.4 → 0.11.5

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: 4c8ab8dd23da24db4847a9f58aa98010d54a15ea
4
- data.tar.gz: 043115dbfa42457092430ea5aa7f4378f39f81ea
3
+ metadata.gz: 28b9ade66f02b2901ab65933aa6eb993e32000ad
4
+ data.tar.gz: 1eb565d3a57c0a62c2e261728dcec8a38f55f141
5
5
  SHA512:
6
- metadata.gz: c5f91a18470ba264264e86a1f9bdffd2bb555e654d2228fc24413876e7bfb0c17f00a52d1ee9056dfa875184159a49c4438bf2740fe0c3d93041cde07df3a6a8
7
- data.tar.gz: dc58b2e4361a927b3e274968746f9d155e1c0e33ebe4e5fc2d5fe173bd7bac5e1155458183a8eec0feec3b4b80d2bca9e3de17f378ada9f5a9580032497456f7
6
+ metadata.gz: 8fe9c09d3c7cb5f2fef232220a1acdd45e09a1b1691a939eba00c00de6299b3cb58c78c6be531ae3bc99d2023bab35ffbc1445cc0d1d9c91acbd79290682fe0e
7
+ data.tar.gz: 2b166f952ea4f0428ff5e54a4aecb7f2835aa70c19dcfc2c9c315a78a6b694e52a3f1dc9f43e09ef50658c929fd0c063fc61e60f64379c6d5c53ff3616c80db7
data/.travis.yml CHANGED
@@ -17,6 +17,7 @@ gemfile:
17
17
  - "gemfiles/rails-3.2.gemfile"
18
18
  - "gemfiles/rails-4.0.gemfile"
19
19
  - "gemfiles/rails-4.1.gemfile"
20
+ - "gemfiles/sequel.gemfile"
20
21
  - "gemfiles/sinatra.gemfile"
21
22
 
22
23
  matrix:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.11.5
2
+ * Add Sequel gem support (https://github.com/jeremyevans/sequel)
3
+
1
4
  # 0.11.4
2
5
  * Make `without_instrumentation` thread safe
3
6
 
data/Rakefile CHANGED
@@ -8,6 +8,7 @@ GEMFILES = %w(
8
8
  rails-4.0
9
9
  rails-4.1
10
10
  rails-4.2
11
+ sequel
11
12
  sinatra
12
13
  )
13
14
 
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sequel'
4
+ gem 'sqlite3'
5
+
6
+ gemspec :path => '../'
data/lib/appsignal.rb CHANGED
@@ -19,6 +19,7 @@ module Appsignal
19
19
  require 'appsignal/integrations/unicorn'
20
20
  require 'appsignal/integrations/sidekiq'
21
21
  require 'appsignal/integrations/resque'
22
+ require 'appsignal/integrations/sequel'
22
23
  end
23
24
 
24
25
  def load_instrumentations
@@ -0,0 +1,26 @@
1
+ if defined?(::Sequel)
2
+ Appsignal.logger.info("Loading Sequel (#{ Sequel::VERSION }) integration")
3
+
4
+ module Appsignal
5
+ module Integrations
6
+ module Sequel
7
+ # Add query instrumentation
8
+ def log_yield(sql, args = nil)
9
+ name = 'sql.sequel'
10
+ payload = {:sql => sql, :args => args}
11
+
12
+ ActiveSupport::Notifications.instrument(name, payload) { yield }
13
+ end
14
+ end # Sequel
15
+ end # Integrations
16
+ end # Appsignal
17
+
18
+ # Register the extension...
19
+ Sequel::Database.register_extension(
20
+ :appsignal_integration,
21
+ Appsignal::Integrations::Sequel
22
+ )
23
+
24
+ # ... and automatically add it to future instances.
25
+ Sequel::Database.extension(:appsignal_integration)
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.11.4'
2
+ VERSION = '0.11.5'
3
3
  end
@@ -0,0 +1,3 @@
1
+ # This is just a placeholder file, as +Sequel.extensions+ forcefully loads it
2
+ # instead of assuming we already did. If you're looking for the integration
3
+ # implementation, you can find it in +lib/appsignal/integrations/sequel.rb+
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Sequel integration", if: sequel_present? do
4
+ let(:file) { File.expand_path('lib/appsignal/integrations/sequel.rb') }
5
+ let(:db) { Sequel.sqlite }
6
+
7
+ before do
8
+ load file
9
+ start_agent
10
+ end
11
+
12
+ context "with Sequel" do
13
+ before { Appsignal::Transaction.create('uuid', 'test') }
14
+
15
+ it "should instrument queries" do
16
+ expect { db['SELECT 1'].all }
17
+ .to change { Appsignal::Transaction.current.events.empty? }
18
+ .from(true).to(false)
19
+ end
20
+ end
21
+ end
@@ -33,7 +33,6 @@ describe Appsignal::Rack::Instrumentation do
33
33
  'rack.input' => StringIO.new,
34
34
  'REQUEST_METHOD' => 'GET',
35
35
  'PATH_INFO' => '/homepage',
36
- 'REQUEST_METHOD' => 'GET',
37
36
  'QUERY_STRING' => 'param=something'
38
37
  }
39
38
  end
data/spec/spec_helper.rb CHANGED
@@ -38,6 +38,13 @@ def capistrano3_present?
38
38
  Gem.loaded_specs['capistrano'].version >= Gem::Version.new('3.0')
39
39
  end
40
40
 
41
+ def sequel_present?
42
+ require 'sequel'
43
+ true
44
+ rescue LoadError
45
+ false
46
+ end
47
+
41
48
  require 'appsignal'
42
49
 
43
50
  Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support/helpers','*.rb'))].each {|f| require f}
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.4
4
+ version: 0.11.5
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: 2015-02-05 00:00:00.000000000 Z
15
+ date: 2015-02-13 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack
@@ -140,6 +140,7 @@ files:
140
140
  - gemfiles/rails-4.0.gemfile
141
141
  - gemfiles/rails-4.1.gemfile
142
142
  - gemfiles/rails-4.2.gemfile
143
+ - gemfiles/sequel.gemfile
143
144
  - gemfiles/sinatra.gemfile
144
145
  - lib/appsignal.rb
145
146
  - lib/appsignal/agent.rb
@@ -164,6 +165,7 @@ files:
164
165
  - lib/appsignal/integrations/passenger.rb
165
166
  - lib/appsignal/integrations/rails.rb
166
167
  - lib/appsignal/integrations/resque.rb
168
+ - lib/appsignal/integrations/sequel.rb
167
169
  - lib/appsignal/integrations/sidekiq.rb
168
170
  - lib/appsignal/integrations/sinatra.rb
169
171
  - lib/appsignal/integrations/unicorn.rb
@@ -180,6 +182,7 @@ files:
180
182
  - lib/generators/appsignal/USAGE
181
183
  - lib/generators/appsignal/appsignal_generator.rb
182
184
  - lib/generators/appsignal/templates/appsignal.yml
185
+ - lib/sequel/extensions/appsignal_integration.rb
183
186
  - lib/vendor/active_support/notifications.rb
184
187
  - lib/vendor/active_support/notifications/fanout.rb
185
188
  - lib/vendor/active_support/notifications/instrumenter.rb
@@ -204,6 +207,7 @@ files:
204
207
  - spec/lib/appsignal/integrations/passenger_spec.rb
205
208
  - spec/lib/appsignal/integrations/rails_spec.rb
206
209
  - spec/lib/appsignal/integrations/resque_spec.rb
210
+ - spec/lib/appsignal/integrations/sequel_spec.rb
207
211
  - spec/lib/appsignal/integrations/sidekiq_spec.rb
208
212
  - spec/lib/appsignal/integrations/sinatra_spec.rb
209
213
  - spec/lib/appsignal/integrations/unicorn_spec.rb
@@ -273,6 +277,7 @@ test_files:
273
277
  - spec/lib/appsignal/integrations/passenger_spec.rb
274
278
  - spec/lib/appsignal/integrations/rails_spec.rb
275
279
  - spec/lib/appsignal/integrations/resque_spec.rb
280
+ - spec/lib/appsignal/integrations/sequel_spec.rb
276
281
  - spec/lib/appsignal/integrations/sidekiq_spec.rb
277
282
  - spec/lib/appsignal/integrations/sinatra_spec.rb
278
283
  - spec/lib/appsignal/integrations/unicorn_spec.rb