appsignal 1.2.3 → 1.2.4.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: cabf1f598a6b8a65589fcaffe602b070ccf109d7
4
- data.tar.gz: 4bbb9154d9add1f427f97b8fc4038b2a54d72a34
3
+ metadata.gz: 3bc6224da35640f9af8d9af3ec9576c4d8b81e4d
4
+ data.tar.gz: 7c4a79901f8c603407eaf5d6819fcb35d0bda50d
5
5
  SHA512:
6
- metadata.gz: f699c46e71f726587c7207fa2d732b92722ae1699bfc890b19d3ef2766255605f7e1792d5db2c2e9eec0bab2f4e5a19201ba7a256f7b6fbd38ce081c282da8fc
7
- data.tar.gz: 0c77fc1ca85b9f3304ad28fcb6fa5db159f912fcab381495f43b221f4ba5640c324e36caa6a9849c2d7560bfc4cd98c403589ac68138807e55bc9040fa42a512
6
+ metadata.gz: 96bd1c57323d23de57ab504526952d5fbc0e0478d6edbe0fad38f4a3821bbe21623647ce335a75dfba3dce7bfe814dc6fc13f393abacedafc52e303746f74b1f
7
+ data.tar.gz: 3632480d9d4ecd9b135084166bf51e35c246a1f2c176d7a0468fa77aebe2a8d055ed57360e2892714189faf167faa89630814653bcd05cbdd475583b7f7af1e7
@@ -3,7 +3,6 @@ sudo: false
3
3
  language: ruby
4
4
 
5
5
  rvm:
6
- - "1.9.3"
7
6
  - "2.0.0"
8
7
  - "2.1.8"
9
8
  - "2.2.4"
@@ -28,8 +27,6 @@ gemfile:
28
27
 
29
28
  matrix:
30
29
  exclude:
31
- - rvm: "1.9.3"
32
- gemfile: "gemfiles/rails-5.0.gemfile"
33
30
  - rvm: "2.0.0"
34
31
  gemfile: "gemfiles/rails-5.0.gemfile"
35
32
  - rvm: "2.1.8"
@@ -1,3 +1,6 @@
1
+ # 1.2.4
2
+ * Support for adding a namespace when mounting Sinatra apps in Rails
3
+
1
4
  # 1.2.3
2
5
  * Catch nil config for installer and diag
3
6
  * Minor performance improvements
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-ruby)
7
+ [![Build Status](https://travis-ci.org/appsignal/appsignal-ruby.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
@@ -2,6 +2,7 @@ require 'rspec/core/rake_task'
2
2
  GEMFILES = %w(
3
3
  capistrano2
4
4
  capistrano3
5
+ grape
5
6
  no_dependencies
6
7
  padrino
7
8
  rails-3.2
@@ -13,11 +14,9 @@ GEMFILES = %w(
13
14
  sequel
14
15
  sequel-435
15
16
  sinatra
16
- grape
17
17
  )
18
18
 
19
19
  RUBY_VERSIONS = %w(
20
- 1.9.3-p551
21
20
  2.0.0-p648
22
21
  2.1.8
23
22
  2.2.4
@@ -25,7 +24,7 @@ RUBY_VERSIONS = %w(
25
24
  )
26
25
 
27
26
  EXCLUSIONS = {
28
- 'rails-5.0' => %w( 1.9.3 2.0.0 2.1.8)
27
+ 'rails-5.0' => %w(2.0.0 2.1.8)
29
28
  }
30
29
 
31
30
  VERSION_MANAGERS = {
@@ -2,6 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'capistrano', '< 3.0'
4
4
  gem 'net-ssh', '2.9.2'
5
- gem 'rack', '~> 1.6.4'
5
+ gem 'rack', '~> 1.6'
6
6
 
7
7
  gemspec :path => '../'
@@ -2,6 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'capistrano', '3.4.0'
4
4
  gem 'net-ssh', '2.9.2'
5
- gem 'rack', '~> 1.6.4'
5
+ gem 'rack', '~> 1.6'
6
6
 
7
7
  gemspec :path => '../'
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'grape', '0.14.0'
4
- gem 'rack', '~> 1.6.4'
4
+ gem 'rack', '~> 1.6'
5
+ gem 'activesupport', '~> 4.2'
5
6
 
6
7
  gemspec :path => '../'
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rack', '~> 1.6.4'
3
+ gem 'rack', '~> 1.6'
4
4
 
5
5
  gemspec :path => '../'
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'padrino', '~> 0.12.0'
4
- gem 'rack', '~> 1.6.4'
4
+ gem 'rack', '~> 1.6'
5
+ gem 'activesupport', '~> 4.2'
5
6
 
6
7
  gemspec :path => '../'
@@ -1,7 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 3.2.14'
4
- gem 'rack', '~> 1.6.4'
5
4
  gem 'test-unit'
6
5
 
7
6
  gemspec :path => '../'
@@ -1,7 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.0.0'
4
- gem 'rack', '~> 1.6.4'
5
4
  gem 'mime-types', '~> 2.6'
6
5
 
7
6
  gemspec :path => '../'
@@ -1,7 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.1.0'
4
- gem 'rack', '~> 1.6.4'
5
4
  gem 'mime-types', '~> 2.6'
6
5
 
7
6
  gemspec :path => '../'
@@ -1,7 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.2.0'
4
- gem 'rack', '~> 1.6.4'
5
4
  gem 'mime-types', '~> 2.6'
6
5
 
7
6
  gemspec :path => '../'
@@ -3,6 +3,5 @@ source 'https://rubygems.org'
3
3
  gem 'resque'
4
4
  gem 'rails', '~> 4.2.0'
5
5
  gem 'mime-types', '~> 2.6'
6
- gem 'rack', '~> 1.6.4'
7
6
 
8
7
  gemspec :path => '../'
@@ -2,6 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'sequel', '~> 4.35'
4
4
  gem 'sqlite3'
5
- gem 'rack', '~> 1.6.4'
5
+ gem 'rack', '~> 1.6'
6
6
 
7
7
  gemspec :path => '../'
@@ -2,6 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'sequel', '< 4.35'
4
4
  gem 'sqlite3'
5
- gem 'rack', '~> 1.6.4'
5
+ gem 'rack', '~> 1.6'
6
6
 
7
7
  gemspec :path => '../'
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'sinatra'
4
- gem 'rack', '~> 1.6.4'
4
+ gem 'rack', '~> 1.6'
5
5
 
6
6
  gemspec :path => '../'
@@ -131,7 +131,7 @@ module Appsignal
131
131
  def monitor_single_transaction(name, env={}, &block)
132
132
  monitor_transaction(name, env, &block)
133
133
  ensure
134
- stop
134
+ stop('monitor_single_transaction')
135
135
  end
136
136
 
137
137
  def listen_for_error(&block)
@@ -232,7 +232,11 @@ module Appsignal
232
232
  "appsignal: #{msg}\n"
233
233
  end
234
234
  end
235
- @logger.level = Logger::INFO
235
+ if config && config[:debug]
236
+ @logger.level = Logger::DEBUG
237
+ else
238
+ @logger.level = Logger::INFO
239
+ end
236
240
  @logger << @in_memory_log.string if @in_memory_log
237
241
 
238
242
  if path_arg
@@ -27,7 +27,8 @@ module Appsignal
27
27
  transaction = Appsignal::Transaction.create(
28
28
  SecureRandom.uuid,
29
29
  Appsignal::Transaction::HTTP_REQUEST,
30
- request
30
+ request,
31
+ {:force => @options.include?(:force) && @options[:force]}
31
32
  )
32
33
  begin
33
34
  ActiveSupport::Notifications.instrument('process_action.sinatra') do
@@ -42,13 +43,23 @@ module Appsignal
42
43
  if !@raise_errors_on && env['sinatra.error'] && !env['sinatra.skip_appsignal_error']
43
44
  transaction.set_error(env['sinatra.error'])
44
45
  end
45
- transaction.set_action(env['sinatra.route'])
46
+ transaction.set_action(action_name(env))
46
47
  transaction.set_metadata('path', request.path)
47
48
  transaction.set_metadata('method', request.request_method)
48
49
  transaction.set_http_or_background_queue_start
49
50
  Appsignal::Transaction.complete_current!
50
51
  end
51
52
  end
53
+
54
+
55
+ def action_name(env)
56
+ if @options.fetch(:mounted_at, nil)
57
+ method, route = env['sinatra.route'].split(" ")
58
+ "#{method} #{@options.fetch(:mounted_at, nil)}#{route}"
59
+ else
60
+ env['sinatra.route']
61
+ end
62
+ end
52
63
  end
53
64
  end
54
65
  end
@@ -28,6 +28,11 @@ module Appsignal
28
28
 
29
29
  class << self
30
30
  def create(id, namespace, request, options={})
31
+ # Allow middleware to force a new transaction
32
+ if options.include?(:force) && options[:force]
33
+ Thread.current[:appsignal_transaction] = nil
34
+ end
35
+
31
36
  # Check if we already have a running transaction
32
37
  if Thread.current[:appsignal_transaction] != nil
33
38
  # Log the issue and return the current transaction
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '1.2.3'
4
+ VERSION = '1.2.4.beta.1'
5
5
  end
@@ -51,7 +51,8 @@ if defined?(::Sinatra)
51
51
  Appsignal::Transaction.should_receive(:create).with(
52
52
  kind_of(String),
53
53
  Appsignal::Transaction::HTTP_REQUEST,
54
- kind_of(Sinatra::Request)
54
+ kind_of(Sinatra::Request),
55
+ kind_of(Hash)
55
56
  ).and_return(double(:set_action => nil, :set_http_or_background_queue_start => nil, :set_metadata => nil))
56
57
  end
57
58
 
@@ -122,6 +123,13 @@ if defined?(::Sinatra)
122
123
  end
123
124
  end
124
125
 
126
+ context "with option to set path prefix" do
127
+ let(:options) {{ :mounted_at => "/api/v2" }}
128
+ it "should call set_action with a prefix path" do
129
+ Appsignal::Transaction.any_instance.should_receive(:set_action).with("GET /api/v2/")
130
+ end
131
+ end
132
+
125
133
  after { middleware.call(env) rescue VerySpecificError }
126
134
  end
127
135
  end
@@ -57,6 +57,16 @@ describe Appsignal::Transaction do
57
57
 
58
58
  Appsignal::Transaction.create('1', namespace, request, options)
59
59
  end
60
+
61
+ context "with option to force a new transaction" do
62
+ let(:options) { {:force => true} }
63
+ it "should not create a new transaction" do
64
+ expect(
65
+ Appsignal::Transaction.create('1', namespace, request, options)
66
+ ).to_not eq(running_transaction)
67
+ end
68
+ end
69
+
60
70
  end
61
71
  end
62
72
 
@@ -521,6 +521,7 @@ describe Appsignal do
521
521
  context "when the log path is writable" do
522
522
  it "should log to file" do
523
523
  Appsignal.start_logger
524
+ Appsignal.logger.level.should == Logger::INFO
524
525
  Appsignal.logger.error('Log to file')
525
526
  File.exists?(log_file).should be_true
526
527
  File.open(log_file).read.should include 'Log to file'
@@ -536,6 +537,7 @@ describe Appsignal do
536
537
 
537
538
  it "should log to stdout" do
538
539
  Appsignal.start_logger
540
+ Appsignal.logger.level.should == Logger::INFO
539
541
  Appsignal.logger.error('Log to stdout')
540
542
  out_stream.string.should include 'appsignal: Log to stdout'
541
543
  out_stream.string.should include 'Log something'
@@ -548,6 +550,22 @@ describe Appsignal do
548
550
  Appsignal.start_logger
549
551
  end
550
552
  end
553
+
554
+ context "when there is no config and debug is on" do
555
+ it "should set the log level to info" do
556
+ Appsignal.config = nil
557
+ Appsignal.start_logger
558
+ Appsignal.logger.level.should == Logger::INFO
559
+ end
560
+ end
561
+
562
+ context "when there is a config and debug is on" do
563
+ it "should set the log level to debug" do
564
+ Appsignal.config.config_hash[:debug] = true
565
+ Appsignal.start_logger
566
+ Appsignal.logger.level.should == Logger::DEBUG
567
+ end
568
+ end
551
569
  end
552
570
 
553
571
  describe ".log_formatter" do
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.3
4
+ version: 1.2.4.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-07-18 00:00:00.000000000 Z
12
+ date: 2016-07-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -300,9 +300,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
300
  version: '1.9'
301
301
  required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  requirements:
303
- - - ">="
303
+ - - ">"
304
304
  - !ruby/object:Gem::Version
305
- version: '0'
305
+ version: 1.3.1
306
306
  requirements: []
307
307
  rubyforge_project:
308
308
  rubygems_version: 2.4.5