appsignal 1.3.6 → 1.4.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +1 -3
- data/CHANGELOG.md +2 -28
- data/Rakefile +2 -2
- data/benchmark.rake +4 -0
- data/circle.yml +12 -0
- data/ext/agent.yml +11 -11
- data/ext/appsignal_extension.c +3 -3
- data/ext/extconf.rb +4 -4
- data/lib/appsignal.rb +10 -27
- data/lib/appsignal/cli/diagnose.rb +3 -4
- data/lib/appsignal/cli/install.rb +15 -16
- data/lib/appsignal/config.rb +7 -18
- data/lib/appsignal/event_formatter.rb +1 -1
- data/lib/appsignal/integrations/capistrano/appsignal.cap +1 -1
- data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +2 -2
- data/lib/appsignal/integrations/object.rb +4 -4
- data/lib/appsignal/integrations/sinatra.rb +1 -1
- data/lib/appsignal/integrations/webmachine.rb +1 -1
- data/lib/appsignal/js_exception_transaction.rb +0 -1
- data/lib/appsignal/marker.rb +2 -3
- data/lib/appsignal/rack/sinatra_instrumentation.rb +5 -12
- data/lib/appsignal/rack/streaming_listener.rb +2 -4
- data/lib/appsignal/transaction.rb +3 -3
- data/lib/appsignal/transmitter.rb +7 -11
- data/lib/appsignal/utils.rb +0 -6
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +2 -0
- data/spec/lib/appsignal/capistrano2_spec.rb +78 -98
- data/spec/lib/appsignal/capistrano3_spec.rb +77 -56
- data/spec/lib/appsignal/cli/diagnose_spec.rb +13 -12
- data/spec/lib/appsignal/cli/install_spec.rb +15 -38
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +5 -2
- data/spec/lib/appsignal/cli_spec.rb +5 -2
- data/spec/lib/appsignal/config_spec.rb +17 -131
- data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/extension_spec.rb +1 -0
- data/spec/lib/appsignal/hooks/celluloid_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/data_mapper_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/net_http_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/passenger_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/puma_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/rake_spec.rb +1 -0
- data/spec/lib/appsignal/hooks/redis_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/sequel_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +4 -1
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +3 -2
- data/spec/lib/appsignal/hooks/unicorn_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +8 -2
- data/spec/lib/appsignal/hooks_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/data_mapper_spec.rb +1 -0
- data/spec/lib/appsignal/integrations/grape_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +1 -0
- data/spec/lib/appsignal/integrations/object_spec.rb +1 -30
- data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/railtie_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/resque_spec.rb +3 -1
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +7 -32
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +11 -4
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +2 -0
- data/spec/lib/appsignal/marker_spec.rb +48 -35
- data/spec/lib/appsignal/minutely_spec.rb +2 -0
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -0
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +2 -0
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -0
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +6 -46
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +4 -3
- data/spec/lib/appsignal/subscriber_spec.rb +2 -0
- data/spec/lib/appsignal/transaction_spec.rb +3 -2
- data/spec/lib/appsignal/transmitter_spec.rb +20 -53
- data/spec/lib/appsignal/update_active_support_spec.rb +2 -0
- data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +2 -0
- data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +2 -0
- data/spec/lib/appsignal/utils_spec.rb +2 -0
- data/spec/lib/appsignal_spec.rb +37 -91
- data/spec/spec_helper.rb +28 -22
- metadata +5 -14
- data/spec/lib/appsignal/utils/gzip_spec.rb +0 -10
- data/spec/support/helpers/api_request_helper.rb +0 -19
- data/spec/support/helpers/directory_helper.rb +0 -25
- data/spec/support/helpers/std_streams_helper.rb +0 -35
- data/spec/support/helpers/very_specific_error.rb +0 -8
data/spec/spec_helper.rb
CHANGED
@@ -1,22 +1,15 @@
|
|
1
1
|
ENV['RAILS_ENV'] ||= 'test'
|
2
|
-
ENV['RACK_ENV'] ||= 'test'
|
3
2
|
ENV['PADRINO_ENV'] ||= 'test'
|
4
3
|
|
5
|
-
APPSIGNAL_SPEC_DIR = File.expand_path(File.dirname(__FILE__))
|
6
|
-
|
7
4
|
require 'rack'
|
8
5
|
require 'rspec'
|
9
6
|
require 'pry'
|
10
7
|
require 'timecop'
|
11
8
|
require 'webmock/rspec'
|
12
9
|
|
13
|
-
|
14
|
-
require f
|
15
|
-
end
|
16
|
-
|
17
|
-
$LOAD_PATH.unshift(File.join(APPSIGNAL_SPEC_DIR, 'support/stubs'))
|
10
|
+
puts "Runnings specs in #{RUBY_VERSION} on #{RUBY_PLATFORM}"
|
18
11
|
|
19
|
-
|
12
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'support/stubs'))
|
20
13
|
|
21
14
|
begin
|
22
15
|
require 'rails'
|
@@ -28,8 +21,6 @@ rescue LoadError
|
|
28
21
|
RAILS_PRESENT = false
|
29
22
|
end
|
30
23
|
|
31
|
-
require 'appsignal'
|
32
|
-
|
33
24
|
def rails_present?
|
34
25
|
RAILS_PRESENT
|
35
26
|
end
|
@@ -110,6 +101,26 @@ rescue LoadError
|
|
110
101
|
false
|
111
102
|
end
|
112
103
|
|
104
|
+
require 'appsignal'
|
105
|
+
|
106
|
+
def spec_dir
|
107
|
+
File.dirname(__FILE__)
|
108
|
+
end
|
109
|
+
|
110
|
+
def tmp_dir
|
111
|
+
@tmp_dir ||= File.expand_path('tmp', spec_dir)
|
112
|
+
end
|
113
|
+
|
114
|
+
def fixtures_dir
|
115
|
+
@fixtures_dir ||= File.expand_path('support/fixtures', spec_dir)
|
116
|
+
end
|
117
|
+
|
118
|
+
def helpers_dir
|
119
|
+
@helpers_dir ||= File.expand_path('support/helpers', spec_dir)
|
120
|
+
end
|
121
|
+
|
122
|
+
Dir[File.join(helpers_dir, '*.rb')].each { |file| require file }
|
123
|
+
|
113
124
|
# Add way to clear subscribers between specs
|
114
125
|
module ActiveSupport
|
115
126
|
module Notifications
|
@@ -123,23 +134,19 @@ module ActiveSupport
|
|
123
134
|
end
|
124
135
|
|
125
136
|
RSpec.configure do |config|
|
126
|
-
config.include DirectoryHelper
|
127
|
-
config.include StdStreamsHelper
|
128
137
|
config.include ConfigHelpers
|
129
138
|
config.include EnvHelpers
|
130
139
|
config.include NotificationHelpers
|
131
140
|
config.include TimeHelpers
|
132
141
|
config.include TransactionHelpers
|
133
|
-
config.include ApiRequestHelper
|
134
142
|
|
135
143
|
config.before :all do
|
136
144
|
FileUtils.rm_rf(tmp_dir)
|
137
145
|
FileUtils.mkdir_p(tmp_dir)
|
146
|
+
end
|
138
147
|
|
139
|
-
|
140
|
-
|
141
|
-
Appsignal::Config.send :const_set, :SYSTEM_TMP_DIR,
|
142
|
-
File.join(tmp_dir, 'system-tmp')
|
148
|
+
config.after do
|
149
|
+
Thread.current[:appsignal_transaction] = nil
|
143
150
|
end
|
144
151
|
|
145
152
|
config.before do
|
@@ -152,10 +159,6 @@ RSpec.configure do |config|
|
|
152
159
|
end
|
153
160
|
end
|
154
161
|
|
155
|
-
config.after do
|
156
|
-
Thread.current[:appsignal_transaction] = nil
|
157
|
-
end
|
158
|
-
|
159
162
|
config.after :all do
|
160
163
|
ActiveSupport::Notifications.notifier.clear_subscribers
|
161
164
|
FileUtils.rm_f(File.join(project_fixture_path, 'log/appsignal.log'))
|
@@ -163,3 +166,6 @@ RSpec.configure do |config|
|
|
163
166
|
Appsignal.logger = nil
|
164
167
|
end
|
165
168
|
end
|
169
|
+
|
170
|
+
class VerySpecificError < RuntimeError
|
171
|
+
end
|
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.
|
4
|
+
version: 1.4.0.alpha.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-09-
|
12
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- appsignal.gemspec
|
130
130
|
- benchmark.rake
|
131
131
|
- bin/appsignal
|
132
|
+
- circle.yml
|
132
133
|
- ext/agent.yml
|
133
134
|
- ext/appsignal_extension.c
|
134
135
|
- ext/extconf.rb
|
@@ -272,7 +273,6 @@ files:
|
|
272
273
|
- spec/lib/appsignal/transaction_spec.rb
|
273
274
|
- spec/lib/appsignal/transmitter_spec.rb
|
274
275
|
- spec/lib/appsignal/update_active_support_spec.rb
|
275
|
-
- spec/lib/appsignal/utils/gzip_spec.rb
|
276
276
|
- spec/lib/appsignal/utils/params_sanitizer_spec.rb
|
277
277
|
- spec/lib/appsignal/utils/query_params_sanitizer_spec.rb
|
278
278
|
- spec/lib/appsignal/utils_spec.rb
|
@@ -282,15 +282,11 @@ files:
|
|
282
282
|
- spec/support/delegate_matcher.rb
|
283
283
|
- spec/support/fixtures/generated_config.yml
|
284
284
|
- spec/support/fixtures/uploaded_file.txt
|
285
|
-
- spec/support/helpers/api_request_helper.rb
|
286
285
|
- spec/support/helpers/config_helpers.rb
|
287
|
-
- spec/support/helpers/directory_helper.rb
|
288
286
|
- spec/support/helpers/env_helpers.rb
|
289
287
|
- spec/support/helpers/notification_helpers.rb
|
290
|
-
- spec/support/helpers/std_streams_helper.rb
|
291
288
|
- spec/support/helpers/time_helpers.rb
|
292
289
|
- spec/support/helpers/transaction_helpers.rb
|
293
|
-
- spec/support/helpers/very_specific_error.rb
|
294
290
|
- spec/support/mocks/mock_extension.rb
|
295
291
|
- spec/support/project_fixture/config/application.rb
|
296
292
|
- spec/support/project_fixture/config/appsignal.yml
|
@@ -316,9 +312,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
316
312
|
version: '1.9'
|
317
313
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
318
314
|
requirements:
|
319
|
-
- - "
|
315
|
+
- - ">"
|
320
316
|
- !ruby/object:Gem::Version
|
321
|
-
version:
|
317
|
+
version: 1.3.1
|
322
318
|
requirements: []
|
323
319
|
rubyforge_project:
|
324
320
|
rubygems_version: 2.4.5
|
@@ -380,7 +376,6 @@ test_files:
|
|
380
376
|
- spec/lib/appsignal/transaction_spec.rb
|
381
377
|
- spec/lib/appsignal/transmitter_spec.rb
|
382
378
|
- spec/lib/appsignal/update_active_support_spec.rb
|
383
|
-
- spec/lib/appsignal/utils/gzip_spec.rb
|
384
379
|
- spec/lib/appsignal/utils/params_sanitizer_spec.rb
|
385
380
|
- spec/lib/appsignal/utils/query_params_sanitizer_spec.rb
|
386
381
|
- spec/lib/appsignal/utils_spec.rb
|
@@ -390,15 +385,11 @@ test_files:
|
|
390
385
|
- spec/support/delegate_matcher.rb
|
391
386
|
- spec/support/fixtures/generated_config.yml
|
392
387
|
- spec/support/fixtures/uploaded_file.txt
|
393
|
-
- spec/support/helpers/api_request_helper.rb
|
394
388
|
- spec/support/helpers/config_helpers.rb
|
395
|
-
- spec/support/helpers/directory_helper.rb
|
396
389
|
- spec/support/helpers/env_helpers.rb
|
397
390
|
- spec/support/helpers/notification_helpers.rb
|
398
|
-
- spec/support/helpers/std_streams_helper.rb
|
399
391
|
- spec/support/helpers/time_helpers.rb
|
400
392
|
- spec/support/helpers/transaction_helpers.rb
|
401
|
-
- spec/support/helpers/very_specific_error.rb
|
402
393
|
- spec/support/mocks/mock_extension.rb
|
403
394
|
- spec/support/project_fixture/config/application.rb
|
404
395
|
- spec/support/project_fixture/config/appsignal.yml
|
@@ -1,10 +0,0 @@
|
|
1
|
-
describe Appsignal::Utils::Gzip do
|
2
|
-
describe ".compress" do
|
3
|
-
let(:value) { "foo" }
|
4
|
-
subject { described_class.compress(value).force_encoding("UTF-8") }
|
5
|
-
|
6
|
-
it "returns a gziped value" do
|
7
|
-
expect(subject).to eq("x\u0001K\xCB\xCF\a\u0000\u0002\x82\u0001E")
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module ApiRequestHelper
|
2
|
-
def stub_api_request(config, path, body)
|
3
|
-
body = Appsignal::Utils::Gzip.compress(Appsignal::Utils::JSON.generate(body))
|
4
|
-
stub_request(:post, "#{config[:endpoint]}/1/#{path}").with(
|
5
|
-
:body => body,
|
6
|
-
:query => {
|
7
|
-
:api_key => config[:push_api_key],
|
8
|
-
:name => config[:name],
|
9
|
-
:environment => config.env,
|
10
|
-
:hostname => config[:hostname],
|
11
|
-
:gem_version => Appsignal::VERSION
|
12
|
-
},
|
13
|
-
:headers => {
|
14
|
-
'Content-Encoding' => 'gzip',
|
15
|
-
'Content-Type' => 'application/json; charset=UTF-8',
|
16
|
-
}
|
17
|
-
)
|
18
|
-
end
|
19
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module DirectoryHelper
|
2
|
-
def project_dir
|
3
|
-
@project_dir ||= File.expand_path('..', spec_dir)
|
4
|
-
end
|
5
|
-
|
6
|
-
def spec_dir
|
7
|
-
APPSIGNAL_SPEC_DIR
|
8
|
-
end
|
9
|
-
|
10
|
-
def support_dir
|
11
|
-
@support_dir ||= File.join(spec_dir, 'support')
|
12
|
-
end
|
13
|
-
|
14
|
-
def tmp_dir
|
15
|
-
@tmp_dir ||= File.join(spec_dir, 'tmp')
|
16
|
-
end
|
17
|
-
|
18
|
-
def fixtures_dir
|
19
|
-
@fixtures_dir ||= File.join(support_dir, 'fixtures')
|
20
|
-
end
|
21
|
-
|
22
|
-
def resources_dir
|
23
|
-
@resources_dir ||= File.join(project_dir, 'resources')
|
24
|
-
end
|
25
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module StdStreamsHelper
|
2
|
-
# Capture STDOUT in a variable
|
3
|
-
#
|
4
|
-
# Usage
|
5
|
-
#
|
6
|
-
# out_stream = StringIO.new
|
7
|
-
# capture_stdout(out_stream) { do_something }
|
8
|
-
def capture_stdout(stdout)
|
9
|
-
original_stdout = $stdout
|
10
|
-
$stdout = stdout
|
11
|
-
|
12
|
-
yield
|
13
|
-
|
14
|
-
$stdout = original_stdout
|
15
|
-
end
|
16
|
-
|
17
|
-
# Capture STDOUT and STDERR in variables
|
18
|
-
#
|
19
|
-
# Usage
|
20
|
-
#
|
21
|
-
# out_stream = StringIO.new
|
22
|
-
# err_stream = StringIO.new
|
23
|
-
# capture_std_streams(out_stream, err_stream) { do_something }
|
24
|
-
def capture_std_streams(stdout, stderr)
|
25
|
-
original_stdout = $stdout
|
26
|
-
$stdout = stdout
|
27
|
-
original_stderr = $stderr
|
28
|
-
$stderr = stderr
|
29
|
-
|
30
|
-
yield
|
31
|
-
|
32
|
-
$stdout = original_stdout
|
33
|
-
$stderr = original_stderr
|
34
|
-
end
|
35
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# This VerySpecificError is used for throwing errors in specs that are allowed
|
2
|
-
# or expected.
|
3
|
-
#
|
4
|
-
# For example, this error can be thrown to raise an exception in AppSignal's
|
5
|
-
# run, which should stop the program and the appsignal gem, but not crash the
|
6
|
-
# test suite.
|
7
|
-
class VerySpecificError < RuntimeError
|
8
|
-
end
|