appsignal 1.2.3 → 1.2.4.beta.1
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 +4 -4
- data/.travis.yml +0 -3
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/Rakefile +2 -3
- data/gemfiles/capistrano2.gemfile +1 -1
- data/gemfiles/capistrano3.gemfile +1 -1
- data/gemfiles/grape.gemfile +2 -1
- data/gemfiles/no_dependencies.gemfile +1 -1
- data/gemfiles/padrino.gemfile +2 -1
- data/gemfiles/rails-3.2.gemfile +0 -1
- data/gemfiles/rails-4.0.gemfile +0 -1
- data/gemfiles/rails-4.1.gemfile +0 -1
- data/gemfiles/rails-4.2.gemfile +0 -1
- data/gemfiles/resque.gemfile +0 -1
- data/gemfiles/sequel-435.gemfile +1 -1
- data/gemfiles/sequel.gemfile +1 -1
- data/gemfiles/sinatra.gemfile +1 -1
- data/lib/appsignal.rb +6 -2
- data/lib/appsignal/rack/sinatra_instrumentation.rb +13 -2
- data/lib/appsignal/transaction.rb +5 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +9 -1
- data/spec/lib/appsignal/transaction_spec.rb +10 -0
- data/spec/lib/appsignal_spec.rb +18 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc6224da35640f9af8d9af3ec9576c4d8b81e4d
|
4
|
+
data.tar.gz: 7c4a79901f8c603407eaf5d6819fcb35d0bda50d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96bd1c57323d23de57ab504526952d5fbc0e0478d6edbe0fad38f4a3821bbe21623647ce335a75dfba3dce7bfe814dc6fc13f393abacedafc52e303746f74b1f
|
7
|
+
data.tar.gz: 3632480d9d4ecd9b135084166bf51e35c246a1f2c176d7a0468fa77aebe2a8d055ed57360e2892714189faf167faa89630814653bcd05cbdd475583b7f7af1e7
|
data/.travis.yml
CHANGED
@@ -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"
|
data/CHANGELOG.md
CHANGED
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
|
-
[](https://travis-ci.org/appsignal/appsignal-ruby)
|
7
|
+
[](https://travis-ci.org/appsignal/appsignal-ruby)
|
8
8
|
[](http://badge.fury.io/rb/appsignal)
|
9
9
|
[](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(
|
27
|
+
'rails-5.0' => %w(2.0.0 2.1.8)
|
29
28
|
}
|
30
29
|
|
31
30
|
VERSION_MANAGERS = {
|
data/gemfiles/grape.gemfile
CHANGED
data/gemfiles/padrino.gemfile
CHANGED
data/gemfiles/rails-3.2.gemfile
CHANGED
data/gemfiles/rails-4.0.gemfile
CHANGED
data/gemfiles/rails-4.1.gemfile
CHANGED
data/gemfiles/rails-4.2.gemfile
CHANGED
data/gemfiles/resque.gemfile
CHANGED
data/gemfiles/sequel-435.gemfile
CHANGED
data/gemfiles/sequel.gemfile
CHANGED
data/gemfiles/sinatra.gemfile
CHANGED
data/lib/appsignal.rb
CHANGED
@@ -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
|
-
|
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
|
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
|
data/lib/appsignal/version.rb
CHANGED
@@ -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
|
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -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.
|
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-
|
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:
|
305
|
+
version: 1.3.1
|
306
306
|
requirements: []
|
307
307
|
rubyforge_project:
|
308
308
|
rubygems_version: 2.4.5
|