appsignal 2.10.3 → 2.10.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 +4 -4
- data/.semaphore/semaphore.yml +964 -0
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/Rakefile +66 -21
- data/appsignal.gemspec +5 -2
- data/build_matrix.yml +94 -49
- data/gemfiles/capistrano2.gemfile +0 -5
- data/gemfiles/capistrano3.gemfile +0 -5
- data/gemfiles/grape.gemfile +0 -5
- data/gemfiles/no_dependencies.gemfile +0 -5
- data/gemfiles/padrino.gemfile +0 -5
- data/gemfiles/que.gemfile +0 -5
- data/gemfiles/que_beta.gemfile +0 -5
- data/gemfiles/rails-3.2.gemfile +0 -5
- data/gemfiles/rails-4.0.gemfile +0 -5
- data/gemfiles/rails-4.1.gemfile +0 -5
- data/gemfiles/rails-4.2.gemfile +0 -5
- data/gemfiles/resque.gemfile +0 -5
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/hooks/net_http.rb +13 -8
- data/lib/appsignal/integrations/grape.rb +2 -1
- data/lib/appsignal/integrations/net_http.rb +16 -0
- data/lib/appsignal/system.rb +6 -0
- data/lib/appsignal/transaction.rb +7 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/grape_spec.rb +10 -0
- data/spec/lib/appsignal/system_spec.rb +36 -0
- data/spec/lib/appsignal/transaction_spec.rb +33 -14
- data/spec/lib/appsignal/transmitter_spec.rb +3 -1
- data/spec/spec_helper.rb +15 -1
- data/support/check_versions +22 -0
- data/support/install_deps +9 -4
- metadata +20 -18
- data/.travis.yml +0 -197
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
@@ -337,7 +337,7 @@ module Appsignal
|
|
337
337
|
path = File.expand_path("../../../../ext/install.report", __FILE__)
|
338
338
|
raw_report = File.read(path)
|
339
339
|
Utils.parse_yaml(raw_report)
|
340
|
-
rescue => e
|
340
|
+
rescue StandardError, Psych::SyntaxError => e # rubocop:disable Lint/ShadowedException
|
341
341
|
{
|
342
342
|
"parsing_error" => {
|
343
343
|
"error" => "#{e.class}: #{e}",
|
@@ -13,15 +13,20 @@ module Appsignal
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def install
|
16
|
-
|
17
|
-
|
16
|
+
if Appsignal::System.ruby_2_or_up?
|
17
|
+
require "appsignal/integrations/net_http"
|
18
|
+
Net::HTTP.send(:prepend, Appsignal::Integrations::NetHttpIntegration)
|
19
|
+
else
|
20
|
+
Net::HTTP.class_eval do
|
21
|
+
alias request_without_appsignal request
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def request(request, body = nil, &block)
|
24
|
+
Appsignal.instrument(
|
25
|
+
"request.net_http",
|
26
|
+
"#{request.method} #{use_ssl? ? "https" : "http"}://#{request["host"] || address}"
|
27
|
+
) do
|
28
|
+
request_without_appsignal(request, body, &block)
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
27
32
|
end
|
@@ -23,7 +23,8 @@ module Appsignal
|
|
23
23
|
begin
|
24
24
|
app.call(env)
|
25
25
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
26
|
-
|
26
|
+
# Do not set error if "grape.skip_appsignal_error" is set to `true`.
|
27
|
+
transaction.set_error(error) unless env["grape.skip_appsignal_error"]
|
27
28
|
raise error
|
28
29
|
ensure
|
29
30
|
request_method = request.request_method.to_s.upcase
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appsignal
|
4
|
+
module Integrations
|
5
|
+
module NetHttpIntegration
|
6
|
+
def request(request, body = nil, &block)
|
7
|
+
Appsignal.instrument(
|
8
|
+
"request.net_http",
|
9
|
+
"#{request.method} #{use_ssl? ? "https" : "http"}://#{request["host"] || address}"
|
10
|
+
) do
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/appsignal/system.rb
CHANGED
@@ -76,8 +76,14 @@ module Appsignal
|
|
76
76
|
ldd_version && ldd_version[0]
|
77
77
|
end
|
78
78
|
|
79
|
+
# @api private
|
79
80
|
def self.jruby?
|
80
81
|
RUBY_PLATFORM == "java"
|
81
82
|
end
|
83
|
+
|
84
|
+
# @api private
|
85
|
+
def self.ruby_2_or_up?
|
86
|
+
versionify(RUBY_VERSION) >= versionify("2.0")
|
87
|
+
end
|
82
88
|
end
|
83
89
|
end
|
@@ -218,7 +218,7 @@ module Appsignal
|
|
218
218
|
from[:controller] || from[:class],
|
219
219
|
from[:action] || from[:method]
|
220
220
|
]
|
221
|
-
|
221
|
+
set_action_if_nil(group_and_action.compact.join("#"))
|
222
222
|
end
|
223
223
|
|
224
224
|
def set_queue_start(start)
|
@@ -248,7 +248,12 @@ module Appsignal
|
|
248
248
|
Appsignal::Utils::Data.generate(data)
|
249
249
|
)
|
250
250
|
rescue RuntimeError => e
|
251
|
-
|
251
|
+
begin
|
252
|
+
inspected_data = data.inspect
|
253
|
+
Appsignal.logger.error("Error generating data (#{e.class}: #{e.message}) for '#{inspected_data}'")
|
254
|
+
rescue => e
|
255
|
+
Appsignal.logger.error("Error generating data (#{e.class}: #{e.message}). Can't inspect data.")
|
256
|
+
end
|
252
257
|
end
|
253
258
|
|
254
259
|
def sample_data
|
data/lib/appsignal/version.rb
CHANGED
@@ -38,7 +38,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
38
38
|
# Because this is saved on the class rather than an instance of the
|
39
39
|
# class we need to clear it like this in case a certain test doesn't
|
40
40
|
# generate a report.
|
41
|
-
cli_class.remove_instance_variable :@data
|
41
|
+
cli_class.send :remove_instance_variable, :@data
|
42
42
|
end
|
43
43
|
|
44
44
|
if DependencyHelper.rails_present?
|
@@ -93,6 +93,16 @@ if DependencyHelper.grape_present?
|
|
93
93
|
expect(transaction).to receive(:set_error).with(kind_of(ExampleException))
|
94
94
|
end
|
95
95
|
|
96
|
+
context "with env['grape.skip_appsignal_error'] = true" do
|
97
|
+
before do
|
98
|
+
env["grape.skip_appsignal_error"] = true
|
99
|
+
end
|
100
|
+
|
101
|
+
it "does not add the error" do
|
102
|
+
expect(transaction).to_not receive(:set_error)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
96
106
|
after do
|
97
107
|
expect { middleware.call(env) }.to raise_error ExampleException
|
98
108
|
end
|
@@ -93,4 +93,40 @@ describe Appsignal::System do
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
96
|
+
|
97
|
+
describe ".ruby_2_or_up?" do
|
98
|
+
around do |example|
|
99
|
+
original_ruby_version = RUBY_VERSION
|
100
|
+
Object.send(:remove_const, "RUBY_VERSION")
|
101
|
+
Object.const_set("RUBY_VERSION", ruby_version)
|
102
|
+
example.run
|
103
|
+
Object.send(:remove_const, "RUBY_VERSION")
|
104
|
+
Object.const_set("RUBY_VERSION", original_ruby_version)
|
105
|
+
end
|
106
|
+
subject { described_class.ruby_2_or_up? }
|
107
|
+
|
108
|
+
context "when on Ruby 1.9" do
|
109
|
+
let(:ruby_version) { "1.9.3-p533" }
|
110
|
+
|
111
|
+
it "returns false" do
|
112
|
+
is_expected.to be(false)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context "when on Ruby 2.0" do
|
117
|
+
let(:ruby_version) { "2.0.0" }
|
118
|
+
|
119
|
+
it "returns true" do
|
120
|
+
is_expected.to be(true)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context "when on Ruby 2.x" do
|
125
|
+
let(:ruby_version) { "2.1.0" }
|
126
|
+
|
127
|
+
it "returns true" do
|
128
|
+
is_expected.to be(true)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
96
132
|
end
|
@@ -441,30 +441,36 @@ describe Appsignal::Transaction do
|
|
441
441
|
|
442
442
|
describe "#set_http_or_background_action" do
|
443
443
|
context "for a hash with controller and action" do
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
444
|
+
it "sets the action" do
|
445
|
+
transaction.set_http_or_background_action(
|
446
|
+
:controller => "HomeController",
|
447
|
+
:action => "show"
|
448
|
+
)
|
449
|
+
expect(transaction.to_h["action"]).to eql("HomeController#show")
|
448
450
|
end
|
449
451
|
end
|
450
452
|
|
451
453
|
context "for a hash with just action" do
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
expect(transaction).to receive(:set_action).with("show")
|
454
|
+
it "sets the action" do
|
455
|
+
transaction.set_http_or_background_action(:action => "show")
|
456
|
+
expect(transaction.to_h["action"]).to eql("show")
|
456
457
|
end
|
457
458
|
end
|
458
459
|
|
459
460
|
context "for a hash with class and method" do
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
expect(transaction).to receive(:set_action).with("Worker#perform")
|
461
|
+
it "sets the action" do
|
462
|
+
transaction.set_http_or_background_action(:class => "Worker", :method => "perform")
|
463
|
+
expect(transaction.to_h["action"]).to eql("Worker#perform")
|
464
464
|
end
|
465
465
|
end
|
466
466
|
|
467
|
-
|
467
|
+
context "when action is already set" do
|
468
|
+
it "does not overwrite the set action" do
|
469
|
+
transaction.set_action("MyCustomAction#perform")
|
470
|
+
transaction.set_http_or_background_action(:class => "Worker", :method => "perform")
|
471
|
+
expect(transaction.to_h["action"]).to eql("MyCustomAction#perform")
|
472
|
+
end
|
473
|
+
end
|
468
474
|
end
|
469
475
|
|
470
476
|
describe "set_queue_start" do
|
@@ -568,7 +574,7 @@ describe Appsignal::Transaction do
|
|
568
574
|
end
|
569
575
|
|
570
576
|
context "when the data cannot be converted to JSON" do
|
571
|
-
it "does not update the sample data on the transaction" do
|
577
|
+
it "does not update the sample data on the transaction", :not_ruby19 do
|
572
578
|
klass = Class.new do
|
573
579
|
def to_s
|
574
580
|
raise "foo" # Cause a deliberate error
|
@@ -580,6 +586,19 @@ describe Appsignal::Transaction do
|
|
580
586
|
expect(log_contents(log)).to contains_log :error,
|
581
587
|
"Error generating data (RuntimeError: foo) for"
|
582
588
|
end
|
589
|
+
|
590
|
+
it "does not update the sample data on the transaction", :only_ruby19 do
|
591
|
+
klass = Class.new do
|
592
|
+
def to_s
|
593
|
+
raise "foo" # Cause a deliberate error
|
594
|
+
end
|
595
|
+
end
|
596
|
+
transaction.set_sample_data("params", klass.new => 1)
|
597
|
+
|
598
|
+
expect(transaction.to_h["sample_data"]).to eq({})
|
599
|
+
expect(log_contents(log)).to contains_log :error,
|
600
|
+
"Error generating data (RuntimeError: foo). Can't inspect data."
|
601
|
+
end
|
583
602
|
end
|
584
603
|
end
|
585
604
|
|
@@ -143,7 +143,9 @@ describe Appsignal::Transmitter do
|
|
143
143
|
context "with a proxy" do
|
144
144
|
let(:config) { project_fixture_config("production", :http_proxy => "http://localhost:8080") }
|
145
145
|
|
146
|
-
it
|
146
|
+
it "is of Net::HTTP class", :not_ruby19 do
|
147
|
+
expect(subject).to be_instance_of(Net::HTTP)
|
148
|
+
end
|
147
149
|
it { expect(subject.proxy?).to be_truthy }
|
148
150
|
it { expect(subject.proxy_address).to eq "localhost" }
|
149
151
|
it { expect(subject.proxy_port).to eq 8080 }
|
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,6 @@ Bundler.require :default
|
|
9
9
|
require "cgi"
|
10
10
|
require "rack"
|
11
11
|
require "rspec"
|
12
|
-
require "pry"
|
13
12
|
require "timecop"
|
14
13
|
require "webmock/rspec"
|
15
14
|
|
@@ -30,6 +29,7 @@ if DependencyHelper.rails_present?
|
|
30
29
|
require f
|
31
30
|
end
|
32
31
|
end
|
32
|
+
require "pry" if DependencyHelper.dependency_present?("pry")
|
33
33
|
require "appsignal"
|
34
34
|
# Include patches of AppSignal modules and classes to make test helpers
|
35
35
|
# available.
|
@@ -81,6 +81,20 @@ RSpec.configure do |config|
|
|
81
81
|
FileUtils.mkdir_p(spec_system_tmp_dir)
|
82
82
|
end
|
83
83
|
|
84
|
+
config.before :each, :only_ruby19 => true do
|
85
|
+
is_ruby19 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0")
|
86
|
+
next if is_ruby19
|
87
|
+
|
88
|
+
skip "Skipping spec. Only for Ruby 1.9"
|
89
|
+
end
|
90
|
+
|
91
|
+
config.before :each, :not_ruby19 => true do
|
92
|
+
is_ruby19 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0")
|
93
|
+
next unless is_ruby19
|
94
|
+
|
95
|
+
skip "Skipping spec for Ruby 1.9"
|
96
|
+
end
|
97
|
+
|
84
98
|
config.before do
|
85
99
|
stop_minutely_probes
|
86
100
|
ENV["RAILS_ENV"] ||= "test"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -eu
|
4
|
+
|
5
|
+
actual_ruby_version=$(ruby --version)
|
6
|
+
if [[ "$actual_ruby_version" == *"jruby"* ]]; then
|
7
|
+
# Replace "-" from specified RUBY_VERSION string. Semaphore/rbenv version uses
|
8
|
+
# a dash, where `jruby --version` uses a space.
|
9
|
+
sanitized_ruby_version="${RUBY_VERSION//-/ }"
|
10
|
+
else
|
11
|
+
# Strip "-" from specified RUBY_VERSION string. Semaphore/rbenv version uses
|
12
|
+
# a dash, where `ruby --version` does not.
|
13
|
+
sanitized_ruby_version="${RUBY_VERSION//-}"
|
14
|
+
fi
|
15
|
+
if [[ "$actual_ruby_version" == *"$sanitized_ruby_version"* ]]; then
|
16
|
+
echo "Ruby version is $RUBY_VERSION"
|
17
|
+
exit 0
|
18
|
+
else
|
19
|
+
echo "Ruby version is: $actual_ruby_version"
|
20
|
+
echo "Ruby version should be: $sanitized_ruby_version"
|
21
|
+
exit 1
|
22
|
+
fi
|
data/support/install_deps
CHANGED
@@ -2,20 +2,25 @@
|
|
2
2
|
|
3
3
|
set -eu
|
4
4
|
|
5
|
+
gem_args="--no-verbose"
|
6
|
+
if [[ $(ruby --version) != "ruby 1.9.3"* ]]; then
|
7
|
+
gem_args+=" --no-document"
|
8
|
+
fi
|
9
|
+
|
5
10
|
case "${_RUBYGEMS_VERSION-"latest"}" in
|
6
11
|
"latest")
|
7
|
-
gem update
|
12
|
+
gem update $gem_args --system
|
8
13
|
;;
|
9
14
|
*)
|
10
|
-
gem update
|
15
|
+
gem update $gem_args --system $_RUBYGEMS_VERSION
|
11
16
|
;;
|
12
17
|
esac
|
13
18
|
|
14
19
|
case "${_BUNDLER_VERSION-"latest"}" in
|
15
20
|
"latest")
|
16
|
-
gem update bundler
|
21
|
+
gem update bundler $gem_args
|
17
22
|
;;
|
18
23
|
*)
|
19
|
-
gem install bundler
|
24
|
+
gem install bundler $gem_args --version $_BUNDLER_VERSION
|
20
25
|
;;
|
21
26
|
esac
|
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: 2.10.
|
4
|
+
version: 2.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '3.8'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: timecop
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: webmock
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - ">="
|
@@ -83,47 +83,47 @@ dependencies:
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
86
|
+
name: yard
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
91
|
+
version: 0.9.20
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
98
|
+
version: 0.9.20
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
|
-
name:
|
100
|
+
name: pry
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0
|
105
|
+
version: '0'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0
|
112
|
+
version: '0'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
114
|
+
name: rubocop
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - '='
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.
|
119
|
+
version: 0.50.0
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - '='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.
|
126
|
+
version: 0.50.0
|
127
127
|
description: The official appsignal.com gem
|
128
128
|
email:
|
129
129
|
- support@appsignal.com
|
@@ -139,7 +139,7 @@ files:
|
|
139
139
|
- ".rspec"
|
140
140
|
- ".rubocop.yml"
|
141
141
|
- ".rubocop_todo.yml"
|
142
|
-
- ".
|
142
|
+
- ".semaphore/semaphore.yml"
|
143
143
|
- ".yardopts"
|
144
144
|
- CHANGELOG.md
|
145
145
|
- CODE_OF_CONDUCT.md
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/appsignal/integrations/delayed_job_plugin.rb
|
228
228
|
- lib/appsignal/integrations/grape.rb
|
229
229
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
230
|
+
- lib/appsignal/integrations/net_http.rb
|
230
231
|
- lib/appsignal/integrations/object.rb
|
231
232
|
- lib/appsignal/integrations/padrino.rb
|
232
233
|
- lib/appsignal/integrations/que.rb
|
@@ -368,6 +369,7 @@ files:
|
|
368
369
|
- spec/support/stubs/sidekiq/api.rb
|
369
370
|
- spec/support/testing.rb
|
370
371
|
- support/bundler_wrapper
|
372
|
+
- support/check_versions
|
371
373
|
- support/install_deps
|
372
374
|
homepage: https://github.com/appsignal/appsignal-ruby
|
373
375
|
licenses:
|