appsignal 1.2.0 → 1.2.1.beta.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: d44539c4d934bc6c75a61244bc52dcc2a67d75a5
4
- data.tar.gz: a90fa4a59e8d2529aa5bfd67e8e80d0184d26792
3
+ metadata.gz: 350007064e166fbb91f0ac4dd1a84d4ef0830c71
4
+ data.tar.gz: cac950f88072c96359cad08e06c348b73ea36d77
5
5
  SHA512:
6
- metadata.gz: a4714eeb4f848bd99460320f35dfcd9429462a49b178c1cb0dcf6e94bab432a4af261ecd68bf07975c4eb15699cd729539cd3f0b109789338405ef7096681c80
7
- data.tar.gz: 66db0f2a4b0019a00b052ae6fde322c6fd4de6621ea7068a90e7f61e5f1740c281ba6817ae7d59ca54819136d44d001ce735b29940c40162928e1055e1c678db
6
+ metadata.gz: 320de9094dddc0782864706cbf8886e30d5e1a5e44a5a828645f19c16b7a18d78becb98c93b582c2d3d8e8678dfef19451ad331fb05664ab7d995f4ebf7ee8e1
7
+ data.tar.gz: e1354c1a4966f439a8220a0147d5d7545654fbaf8acd060ef1b40efc42255f6c80691653b82d92eb4cb7ff1626db1e657809e2f95a967175ada8021e15139d3a
@@ -22,6 +22,7 @@ gemfile:
22
22
  - "gemfiles/rails-5.0.gemfile"
23
23
  - "gemfiles/resque.gemfile"
24
24
  - "gemfiles/sequel.gemfile"
25
+ - "gemfiles/sequel-435.gemfile"
25
26
  - "gemfiles/sinatra.gemfile"
26
27
  - "gemfiles/grape.gemfile"
27
28
 
@@ -1,3 +1,8 @@
1
+ # 1.2.1
2
+ * Use Dir.pwd in CLI install wizard
3
+ * Support bignums when setting queue length
4
+ * Support for Sequel 4.35
5
+
1
6
  # 1.2.0
2
7
  * Restart background thread when FD's are closed
3
8
  * Beta version of collecting host metrics (disabled by default)
data/README.md CHANGED
@@ -4,7 +4,7 @@ AppSignal agent
4
4
  This gem collects error and performance data from your Rails
5
5
  applications and sends it to [AppSignal](https://appsignal.com)
6
6
 
7
- [![Build Status](https://travis-ci.org/appsignal/appsignal.png?branch=master)](https://travis-ci.org/appsignal/appsignal)
7
+ [![Build Status](https://travis-ci.org/appsignal/appsignal.png?branch=master)](https://travis-ci.org/appsignal/appsignal-ruby)
8
8
  [![Gem Version](https://badge.fury.io/rb/appsignal.svg)](http://badge.fury.io/rb/appsignal)
9
9
  [![Code Climate](https://codeclimate.com/github/appsignal/appsignal.png)](https://codeclimate.com/github/appsignal/appsignal)
10
10
 
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ GEMFILES = %w(
11
11
  rails-5.0
12
12
  resque
13
13
  sequel
14
+ sequel-435
14
15
  sinatra
15
16
  grape
16
17
  )
@@ -1,15 +1,15 @@
1
1
  ---
2
- version: 9eb5938
2
+ version: 2dbe674
3
3
  triples:
4
4
  x86_64-linux:
5
- checksum: d66427bad79417552567527ccbba1be0984c22dd3d58857da69566d531ef2cd8
6
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9eb5938/appsignal-x86_64-linux-all-static.tar.gz
5
+ checksum: 1b6fc9edd036b7f36810430a95b78fded2b901fa7d5fb8d2de9677de7df3c106
6
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/2dbe674/appsignal-x86_64-linux-all-static.tar.gz
7
7
  i686-linux:
8
- checksum: 30fb48f9f28004bb4ca41e7af83efbe8781208e4d9dcc044df069dc74f894363
9
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9eb5938/appsignal-i686-linux-all-static.tar.gz
8
+ checksum: fccad1b6c1df87fe7ed3c001567f902a95a029006354db2f10c512dc5ce0c262
9
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/2dbe674/appsignal-i686-linux-all-static.tar.gz
10
10
  x86-linux:
11
- checksum: 30fb48f9f28004bb4ca41e7af83efbe8781208e4d9dcc044df069dc74f894363
12
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9eb5938/appsignal-i686-linux-all-static.tar.gz
11
+ checksum: fccad1b6c1df87fe7ed3c001567f902a95a029006354db2f10c512dc5ce0c262
12
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/2dbe674/appsignal-i686-linux-all-static.tar.gz
13
13
  x86_64-darwin:
14
- checksum: 356032a3c8f137481c19cb6b960117a2e11aeacbc7d663ae05e11e710bd3f6cd
15
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9eb5938/appsignal-x86_64-darwin-all-static.tar.gz
14
+ checksum: 0129536474fdfd4db707f74de467796aeca5862ef1d792d4e9b3a8badae55156
15
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/2dbe674/appsignal-x86_64-darwin-all-static.tar.gz
@@ -123,13 +123,18 @@ static VALUE set_transaction_action(VALUE self, VALUE action) {
123
123
 
124
124
  static VALUE set_transaction_queue_start(VALUE self, VALUE queue_start) {
125
125
  appsignal_transaction* transaction;
126
+ int queue_start_type;
127
+
128
+ queue_start_type = TYPE(queue_start);
129
+ if (queue_start_type != T_FIXNUM && queue_start_type != T_BIGNUM) {
130
+ rb_raise(rb_eTypeError, "queue_start should be a Fixnum or Bignum");
131
+ }
126
132
 
127
- Check_Type(queue_start, T_FIXNUM);
128
133
  Data_Get_Struct(self, appsignal_transaction, transaction);
129
134
 
130
135
  appsignal_set_transaction_queue_start(
131
136
  transaction,
132
- FIX2LONG(queue_start)
137
+ NUM2LONG(queue_start)
133
138
  );
134
139
  return Qnil;
135
140
  }
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sequel', '~> 4.35'
4
+ gem 'sqlite3'
5
+
6
+ gemspec :path => '../'
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'sequel'
3
+ gem 'sequel', '< 4.35'
4
4
  gem 'sqlite3'
5
5
 
6
6
  gemspec :path => '../'
@@ -39,7 +39,7 @@ module Appsignal
39
39
 
40
40
  unless @config
41
41
  @config = Config.new(
42
- ENV['PWD'],
42
+ Dir.pwd,
43
43
  ENV['APPSIGNAL_APP_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV']
44
44
  )
45
45
  end
@@ -45,7 +45,7 @@ module Appsignal
45
45
 
46
46
  def config
47
47
  Appsignal::Config.new(
48
- ENV['PWD'],
48
+ Dir.pwd,
49
49
  options[:environment],
50
50
  initial_config,
51
51
  Logger.new(StringIO.new)
@@ -64,7 +64,7 @@ module Appsignal
64
64
  end
65
65
 
66
66
  def install_for_rails(config)
67
- require File.expand_path(File.join(ENV['PWD'], 'config/application.rb'))
67
+ require File.expand_path(File.join(Dir.pwd, 'config/application.rb'))
68
68
 
69
69
  puts 'Installing for Ruby on Rails'
70
70
 
@@ -187,7 +187,7 @@ module Appsignal
187
187
  end
188
188
 
189
189
  def configure(config, environments, name_overwritten)
190
- deploy_rb_file = File.join(ENV['PWD'], 'config/deploy.rb')
190
+ deploy_rb_file = File.join(Dir.pwd, 'config/deploy.rb')
191
191
  if File.exists?(deploy_rb_file) && (File.read(deploy_rb_file) =~ /require (\'|\").\/appsignal\/capistrano/).nil?
192
192
  print 'Adding AppSignal integration to deploy.rb'
193
193
  File.open(deploy_rb_file, 'a') do |f|
@@ -285,7 +285,7 @@ module Appsignal
285
285
 
286
286
  def rails_environments
287
287
  @environments ||= Dir.glob(
288
- File.join(ENV['PWD'], 'config/environments/*.rb')
288
+ File.join(Dir.pwd, 'config/environments/*.rb')
289
289
  ).map { |o| File.basename(o, ".rb") }.sort - EXCLUDED_ENVIRONMENTS
290
290
  end
291
291
 
@@ -298,8 +298,8 @@ module Appsignal
298
298
 
299
299
  config = template.result(OpenStruct.new(data).instance_eval { binding })
300
300
 
301
- FileUtils.mkdir_p(File.join(ENV['PWD'], 'config'))
302
- File.write(File.join(ENV['PWD'], 'config/appsignal.yml'), config)
301
+ FileUtils.mkdir_p(File.join(Dir.pwd, 'config'))
302
+ File.write(File.join(Dir.pwd, 'config/appsignal.yml'), config)
303
303
  end
304
304
  end
305
305
  end
@@ -1,6 +1,6 @@
1
1
  module Appsignal
2
2
  class Hooks
3
- module SequelExtension
3
+ module SequelLogExtension
4
4
  # Add query instrumentation
5
5
  def log_yield(sql, args = nil)
6
6
  ActiveSupport::Notifications.instrument(
@@ -12,6 +12,18 @@ module Appsignal
12
12
  end
13
13
  end
14
14
 
15
+ module SequelLogConnectionExtension
16
+ # Add query instrumentation
17
+ def log_connection_yield(sql, conn, args = nil)
18
+ ActiveSupport::Notifications.instrument(
19
+ 'sql.sequel',
20
+ :sql => sql
21
+ ) do
22
+ yield
23
+ end
24
+ end
25
+ end
26
+
15
27
  class SequelHook < Appsignal::Hooks::Hook
16
28
  register :sequel
17
29
 
@@ -23,10 +35,17 @@ module Appsignal
23
35
 
24
36
  def install
25
37
  # Register the extension...
26
- ::Sequel::Database.register_extension(
27
- :appsignal_integration,
28
- Appsignal::Hooks::SequelExtension
29
- )
38
+ if ::Sequel::MAJOR >= 4 && ::Sequel::MINOR >= 35
39
+ ::Sequel::Database.register_extension(
40
+ :appsignal_integration,
41
+ Appsignal::Hooks::SequelLogConnectionExtension
42
+ )
43
+ else
44
+ ::Sequel::Database.register_extension(
45
+ :appsignal_integration,
46
+ Appsignal::Hooks::SequelLogExtension
47
+ )
48
+ end
30
49
 
31
50
  # ... and automatically add it to future instances.
32
51
  ::Sequel::Database.extension(:appsignal_integration)
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1.beta.1'
5
5
  end
@@ -13,7 +13,7 @@ describe Appsignal::CLI::Install do
13
13
  let(:auth_check) { double }
14
14
 
15
15
  before do
16
- ENV['PWD'] = project_fixture_path
16
+ Dir.stub(:pwd => project_fixture_path)
17
17
  @original_stdout = $stdout
18
18
  $stdout = out_stream
19
19
  Appsignal::AuthCheck.stub(:new => auth_check)
@@ -113,7 +113,7 @@ describe Appsignal::CLI::Install do
113
113
 
114
114
  describe ".rails_environments" do
115
115
  before do
116
- ENV['PWD'] = project_fixture_path
116
+ Dir.stub(:pwd => project_fixture_path)
117
117
  end
118
118
 
119
119
  subject { cli.rails_environments }
@@ -379,7 +379,7 @@ describe Appsignal::CLI::Install do
379
379
  let(:config_dir) { File.join(tmp_dir, 'config') }
380
380
  let(:deploy_rb_file) { File.join(tmp_dir, 'config/deploy.rb') }
381
381
  before do
382
- ENV['PWD'] = tmp_dir
382
+ Dir.stub(:pwd => tmp_dir)
383
383
  FileUtils.mkdir_p(config_dir)
384
384
  FileUtils.touch(deploy_rb_file)
385
385
  cli.should_receive(:gets).once.and_return('2')
@@ -423,7 +423,7 @@ describe Appsignal::CLI::Install do
423
423
 
424
424
  context ".write_config_file" do
425
425
  before do
426
- ENV['PWD'] = tmp_dir
426
+ Dir.stub(:pwd => tmp_dir)
427
427
  end
428
428
 
429
429
  it "should write a config file with environments" do
@@ -7,7 +7,7 @@ describe Appsignal::CLI do
7
7
  before do
8
8
  @original_stdout = $stdout
9
9
  $stdout = out_stream
10
- ENV['PWD'] = project_fixture_path
10
+ Dir.stub(:pwd => project_fixture_path)
11
11
  cli.options = {:environment => 'production'}
12
12
  end
13
13
  after do
@@ -1,16 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Sequel integration", if: sequel_present? do
3
+ describe Appsignal::Hooks::SequelHook, if: sequel_present? do
4
4
  let(:db) { Sequel.sqlite }
5
5
 
6
- before do
6
+ before :all do
7
7
  start_agent
8
8
  end
9
9
 
10
- context "with Sequel" do
11
- before { Appsignal::Transaction.create('uuid', Appsignal::Transaction::HTTP_REQUEST, 'test') }
10
+ its(:dependencies_present?) { should be_true }
12
11
 
12
+ context "with a transaction" do
13
13
  it "should instrument queries" do
14
+ Appsignal::Transaction.create('uuid', Appsignal::Transaction::HTTP_REQUEST, 'test')
14
15
  expect( Appsignal::Transaction.current ).to receive(:start_event)
15
16
  .at_least(:once)
16
17
  expect( Appsignal::Transaction.current ).to receive(:finish_event)
@@ -21,3 +22,7 @@ describe "Sequel integration", if: sequel_present? do
21
22
  end
22
23
  end
23
24
  end
25
+
26
+ describe Appsignal::Hooks::SequelHook, unless: sequel_present? do
27
+ its(:dependencies_present?) { should be_false }
28
+ end
@@ -142,7 +142,6 @@ RSpec.configure do |config|
142
142
  end
143
143
 
144
144
  config.before do
145
- ENV['PWD'] = File.expand_path(File.join(File.dirname(__FILE__), '../'))
146
145
  ENV['RAILS_ENV'] = 'test'
147
146
 
148
147
  # Clean environment
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.2.0
4
+ version: 1.2.1.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: 2016-06-16 00:00:00.000000000 Z
12
+ date: 2016-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -144,6 +144,7 @@ files:
144
144
  - gemfiles/rails-4.2.gemfile
145
145
  - gemfiles/rails-5.0.gemfile
146
146
  - gemfiles/resque.gemfile
147
+ - gemfiles/sequel-435.gemfile
147
148
  - gemfiles/sequel.gemfile
148
149
  - gemfiles/sinatra.gemfile
149
150
  - lib/appsignal.rb
@@ -299,9 +300,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
299
300
  version: '1.9'
300
301
  required_rubygems_version: !ruby/object:Gem::Requirement
301
302
  requirements:
302
- - - ">="
303
+ - - ">"
303
304
  - !ruby/object:Gem::Version
304
- version: '0'
305
+ version: 1.3.1
305
306
  requirements: []
306
307
  rubyforge_project:
307
308
  rubygems_version: 2.4.5