airbrake 9.2.1 → 9.2.2
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/lib/airbrake/rack/middleware.rb +21 -13
- data/lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb +20 -2
- data/lib/airbrake/version.rb +1 -1
- metadata +5 -81
- data/spec/apps/rack/dummy_app.rb +0 -17
- data/spec/apps/rails/dummy_app.rb +0 -258
- data/spec/apps/rails/dummy_task.rake +0 -15
- data/spec/apps/rails/logs/32.log +0 -34094
- data/spec/apps/rails/logs/42.log +0 -1488
- data/spec/apps/rails/logs/52.log +0 -6321
- data/spec/apps/sinatra/sinatra_test_app.rb +0 -12
- data/spec/integration/rack/rack_spec.rb +0 -19
- data/spec/integration/rails/rails_spec.rb +0 -430
- data/spec/integration/rails/rake_spec.rb +0 -97
- data/spec/integration/shared_examples/rack_examples.rb +0 -110
- data/spec/integration/sinatra/sinatra_spec.rb +0 -30
- data/spec/spec_helper.rb +0 -105
- data/spec/support/matchers/a_notice_with.rb +0 -29
- data/spec/unit/logger_spec.rb +0 -125
- data/spec/unit/rack/context_filter_spec.rb +0 -90
- data/spec/unit/rack/http_headers_filter_spec.rb +0 -44
- data/spec/unit/rack/http_params_filter_spec.rb +0 -58
- data/spec/unit/rack/instrumentable_spec.rb +0 -105
- data/spec/unit/rack/middleware_spec.rb +0 -98
- data/spec/unit/rack/rack_spec.rb +0 -46
- data/spec/unit/rack/request_body_filter_spec.rb +0 -44
- data/spec/unit/rack/request_store_spec.rb +0 -36
- data/spec/unit/rack/route_filter_spec.rb +0 -52
- data/spec/unit/rack/session_filter_spec.rb +0 -44
- data/spec/unit/rack/user_filter_spec.rb +0 -30
- data/spec/unit/rack/user_spec.rb +0 -218
- data/spec/unit/rails/action_cable/notify_callback_spec.rb +0 -26
- data/spec/unit/rails/action_controller_notify_subscriber_spec.rb +0 -43
- data/spec/unit/rails/action_controller_performance_breakdown_subscriber_spec.rb +0 -63
- data/spec/unit/rails/action_controller_route_subscriber_spec.rb +0 -84
- data/spec/unit/rails/active_record_subscriber_spec.rb +0 -70
- data/spec/unit/rails/excon_spec.rb +0 -46
- data/spec/unit/rake/tasks_spec.rb +0 -70
- data/spec/unit/shoryuken_spec.rb +0 -55
- data/spec/unit/sidekiq/retryable_jobs_filter_spec.rb +0 -36
- data/spec/unit/sidekiq_spec.rb +0 -33
- data/spec/unit/sneakers_spec.rb +0 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c238934628051f11250e289d3c226c8480bd3ae
|
4
|
+
data.tar.gz: fcfd36d25c4280006f64c049422c968b6ca24cae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f4b6f4e2aa13eeb7d3cedfc4ed912893f9c0bafa88053aefb0a8d1794cc301ac88bc401c5a443e5185919e25a2739afde708d925fd1301703054066e67ed584
|
7
|
+
data.tar.gz: 891f4da4c53e22dd462db6e92ccca26dd83d956c7fc524dbad83d9d2be07dd583c639d4f26857c659ee5c5ec7531592a5be91b45b8394f322c71e7080dfbd64c
|
@@ -26,13 +26,12 @@ module Airbrake
|
|
26
26
|
#
|
27
27
|
# @param [Hash] env the Rack environment
|
28
28
|
def call!(env)
|
29
|
-
|
30
|
-
RequestStore[:routes] = {}
|
29
|
+
before_call(env)
|
31
30
|
|
32
31
|
begin
|
33
32
|
response = @app.call(env)
|
34
33
|
rescue Exception => ex # rubocop:disable Lint/RescueException
|
35
|
-
notify_airbrake(ex
|
34
|
+
notify_airbrake(ex)
|
36
35
|
raise ex
|
37
36
|
ensure
|
38
37
|
# Clear routes for the next request.
|
@@ -40,27 +39,36 @@ module Airbrake
|
|
40
39
|
end
|
41
40
|
|
42
41
|
exception = framework_exception(env)
|
43
|
-
notify_airbrake(exception
|
42
|
+
notify_airbrake(exception) if exception
|
44
43
|
|
45
44
|
response
|
46
45
|
end
|
47
46
|
|
48
47
|
private
|
49
48
|
|
50
|
-
def
|
49
|
+
def before_call(env)
|
50
|
+
# Rails hooks such as ActionControllerRouteSubscriber rely on this.
|
51
|
+
RequestStore[:routes] = {}
|
52
|
+
RequestStore[:request] = find_request(env)
|
53
|
+
end
|
54
|
+
|
55
|
+
def find_request(env)
|
56
|
+
if defined?(ActionDispatch::Request)
|
57
|
+
ActionDispatch::Request.new(env)
|
58
|
+
elsif defined?(Sinatra::Request)
|
59
|
+
Sinatra::Request.new(env)
|
60
|
+
else
|
61
|
+
::Rack::Request.new(env)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def notify_airbrake(exception)
|
51
66
|
notice = Airbrake.build_notice(exception)
|
52
67
|
return unless notice
|
53
68
|
|
54
69
|
# ActionDispatch::Request correctly captures server port when using SSL:
|
55
70
|
# See: https://github.com/airbrake/airbrake/issues/802
|
56
|
-
notice.stash[:rack_request] =
|
57
|
-
if defined?(ActionDispatch::Request)
|
58
|
-
ActionDispatch::Request.new(env)
|
59
|
-
elsif defined?(Sinatra::Request)
|
60
|
-
Sinatra::Request.new(env)
|
61
|
-
else
|
62
|
-
::Rack::Request.new(env)
|
63
|
-
end
|
71
|
+
notice.stash[:rack_request] = RequestStore[:request]
|
64
72
|
|
65
73
|
Airbrake.notify(notice)
|
66
74
|
end
|
@@ -9,20 +9,38 @@ module Airbrake
|
|
9
9
|
return if !routes || routes.none?
|
10
10
|
|
11
11
|
event = Airbrake::Rails::Event.new(*args)
|
12
|
+
stash = build_stash
|
12
13
|
|
13
14
|
routes.each do |route, params|
|
14
15
|
groups = event.groups.merge(params[:groups])
|
15
16
|
next if groups.none?
|
16
17
|
|
17
|
-
|
18
|
+
breakdown_info = {
|
18
19
|
method: event.method,
|
19
20
|
route: route,
|
20
21
|
response_type: event.response_type,
|
21
22
|
groups: groups,
|
22
23
|
start_time: event.time
|
23
|
-
|
24
|
+
}
|
25
|
+
|
26
|
+
Airbrake.notify_performance_breakdown(breakdown_info, stash)
|
24
27
|
end
|
25
28
|
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def build_stash
|
33
|
+
stash = {}
|
34
|
+
request = Airbrake::Rack::RequestStore[:request]
|
35
|
+
return stash unless request
|
36
|
+
|
37
|
+
stash[:request] = request
|
38
|
+
if (user = Airbrake::Rack::User.extract(request.env))
|
39
|
+
stash.merge!(user.as_json)
|
40
|
+
end
|
41
|
+
|
42
|
+
stash
|
43
|
+
end
|
26
44
|
end
|
27
45
|
end
|
28
46
|
end
|
data/lib/airbrake/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.2.
|
4
|
+
version: 9.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake-ruby
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -373,44 +373,6 @@ files:
|
|
373
373
|
- lib/airbrake/version.rb
|
374
374
|
- lib/generators/airbrake_generator.rb
|
375
375
|
- lib/generators/airbrake_initializer.rb.erb
|
376
|
-
- spec/apps/rack/dummy_app.rb
|
377
|
-
- spec/apps/rails/dummy_app.rb
|
378
|
-
- spec/apps/rails/dummy_task.rake
|
379
|
-
- spec/apps/rails/logs/32.log
|
380
|
-
- spec/apps/rails/logs/42.log
|
381
|
-
- spec/apps/rails/logs/52.log
|
382
|
-
- spec/apps/sinatra/sinatra_test_app.rb
|
383
|
-
- spec/integration/rack/rack_spec.rb
|
384
|
-
- spec/integration/rails/rails_spec.rb
|
385
|
-
- spec/integration/rails/rake_spec.rb
|
386
|
-
- spec/integration/shared_examples/rack_examples.rb
|
387
|
-
- spec/integration/sinatra/sinatra_spec.rb
|
388
|
-
- spec/spec_helper.rb
|
389
|
-
- spec/support/matchers/a_notice_with.rb
|
390
|
-
- spec/unit/logger_spec.rb
|
391
|
-
- spec/unit/rack/context_filter_spec.rb
|
392
|
-
- spec/unit/rack/http_headers_filter_spec.rb
|
393
|
-
- spec/unit/rack/http_params_filter_spec.rb
|
394
|
-
- spec/unit/rack/instrumentable_spec.rb
|
395
|
-
- spec/unit/rack/middleware_spec.rb
|
396
|
-
- spec/unit/rack/rack_spec.rb
|
397
|
-
- spec/unit/rack/request_body_filter_spec.rb
|
398
|
-
- spec/unit/rack/request_store_spec.rb
|
399
|
-
- spec/unit/rack/route_filter_spec.rb
|
400
|
-
- spec/unit/rack/session_filter_spec.rb
|
401
|
-
- spec/unit/rack/user_filter_spec.rb
|
402
|
-
- spec/unit/rack/user_spec.rb
|
403
|
-
- spec/unit/rails/action_cable/notify_callback_spec.rb
|
404
|
-
- spec/unit/rails/action_controller_notify_subscriber_spec.rb
|
405
|
-
- spec/unit/rails/action_controller_performance_breakdown_subscriber_spec.rb
|
406
|
-
- spec/unit/rails/action_controller_route_subscriber_spec.rb
|
407
|
-
- spec/unit/rails/active_record_subscriber_spec.rb
|
408
|
-
- spec/unit/rails/excon_spec.rb
|
409
|
-
- spec/unit/rake/tasks_spec.rb
|
410
|
-
- spec/unit/shoryuken_spec.rb
|
411
|
-
- spec/unit/sidekiq/retryable_jobs_filter_spec.rb
|
412
|
-
- spec/unit/sidekiq_spec.rb
|
413
|
-
- spec/unit/sneakers_spec.rb
|
414
376
|
homepage: https://airbrake.io
|
415
377
|
licenses:
|
416
378
|
- MIT
|
@@ -436,42 +398,4 @@ signing_key:
|
|
436
398
|
specification_version: 4
|
437
399
|
summary: Airbrake is an online tool that provides robust exception tracking in any
|
438
400
|
of your Ruby applications.
|
439
|
-
test_files:
|
440
|
-
- spec/spec_helper.rb
|
441
|
-
- spec/unit/sidekiq/retryable_jobs_filter_spec.rb
|
442
|
-
- spec/unit/logger_spec.rb
|
443
|
-
- spec/unit/rake/tasks_spec.rb
|
444
|
-
- spec/unit/sidekiq_spec.rb
|
445
|
-
- spec/unit/shoryuken_spec.rb
|
446
|
-
- spec/unit/sneakers_spec.rb
|
447
|
-
- spec/unit/rack/request_store_spec.rb
|
448
|
-
- spec/unit/rack/request_body_filter_spec.rb
|
449
|
-
- spec/unit/rack/http_params_filter_spec.rb
|
450
|
-
- spec/unit/rack/http_headers_filter_spec.rb
|
451
|
-
- spec/unit/rack/rack_spec.rb
|
452
|
-
- spec/unit/rack/middleware_spec.rb
|
453
|
-
- spec/unit/rack/session_filter_spec.rb
|
454
|
-
- spec/unit/rack/context_filter_spec.rb
|
455
|
-
- spec/unit/rack/user_filter_spec.rb
|
456
|
-
- spec/unit/rack/instrumentable_spec.rb
|
457
|
-
- spec/unit/rack/user_spec.rb
|
458
|
-
- spec/unit/rack/route_filter_spec.rb
|
459
|
-
- spec/unit/rails/action_controller_performance_breakdown_subscriber_spec.rb
|
460
|
-
- spec/unit/rails/active_record_subscriber_spec.rb
|
461
|
-
- spec/unit/rails/action_cable/notify_callback_spec.rb
|
462
|
-
- spec/unit/rails/action_controller_notify_subscriber_spec.rb
|
463
|
-
- spec/unit/rails/action_controller_route_subscriber_spec.rb
|
464
|
-
- spec/unit/rails/excon_spec.rb
|
465
|
-
- spec/integration/sinatra/sinatra_spec.rb
|
466
|
-
- spec/integration/rack/rack_spec.rb
|
467
|
-
- spec/integration/shared_examples/rack_examples.rb
|
468
|
-
- spec/integration/rails/rake_spec.rb
|
469
|
-
- spec/integration/rails/rails_spec.rb
|
470
|
-
- spec/support/matchers/a_notice_with.rb
|
471
|
-
- spec/apps/sinatra/sinatra_test_app.rb
|
472
|
-
- spec/apps/rack/dummy_app.rb
|
473
|
-
- spec/apps/rails/dummy_task.rake
|
474
|
-
- spec/apps/rails/dummy_app.rb
|
475
|
-
- spec/apps/rails/logs/42.log
|
476
|
-
- spec/apps/rails/logs/52.log
|
477
|
-
- spec/apps/rails/logs/32.log
|
401
|
+
test_files: []
|
data/spec/apps/rack/dummy_app.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
DummyApp = Rack::Builder.new do
|
2
|
-
use Rack::ShowExceptions
|
3
|
-
use Airbrake::Rack::Middleware
|
4
|
-
use Warden::Manager
|
5
|
-
|
6
|
-
map '/' do
|
7
|
-
run(
|
8
|
-
proc do |_env|
|
9
|
-
[200, { 'Content-Type' => 'text/plain' }, ['Hello from index']]
|
10
|
-
end
|
11
|
-
)
|
12
|
-
end
|
13
|
-
|
14
|
-
map '/crash' do
|
15
|
-
run(proc { |_env| raise AirbrakeTestError })
|
16
|
-
end
|
17
|
-
end
|
@@ -1,258 +0,0 @@
|
|
1
|
-
require 'curb' unless Airbrake::JRUBY
|
2
|
-
require 'excon'
|
3
|
-
|
4
|
-
class DummyApp < Rails::Application
|
5
|
-
# Rails requires these two keys.
|
6
|
-
config.session_store :cookie_store, key: 'jiez4Mielu1AiHugog3shiiPhe3lai3faer'
|
7
|
-
config.secret_token = 'ni6aeph6aeriBiphesh8omahv6cohpue5Quah5ceiMohtuvei8'
|
8
|
-
|
9
|
-
if Gem::Version.new(Rails.version) > Gem::Version.new('3.2.0')
|
10
|
-
config.secret_key_base = '62773890cad9d9d584b57320f8612f8f7378a90aadcabc6ee'
|
11
|
-
end
|
12
|
-
|
13
|
-
# Configure a logger, without it the tests can't run.
|
14
|
-
vsn = Rails.version.split('').values_at(0, 2).join('')
|
15
|
-
log_path = File.join(File.dirname(__FILE__), 'logs', "#{vsn}.log")
|
16
|
-
config.logger = Logger.new(log_path)
|
17
|
-
Rails.logger = config.logger
|
18
|
-
|
19
|
-
config.active_support.deprecation = :stderr
|
20
|
-
|
21
|
-
config.middleware.use Warden::Manager
|
22
|
-
|
23
|
-
# In Rails 4.2.x Active Record suppresses errors raised within
|
24
|
-
# 'after_rollback' & 'after_commit' callbacks and only print them to the
|
25
|
-
# logs. In the next version, these errors will no longer be suppressed.
|
26
|
-
# Instead, the errors will propagate normally just like in other Active Record
|
27
|
-
# callbacks.
|
28
|
-
config.active_record.raise_in_transactional_callbacks = true if vsn == '42'
|
29
|
-
|
30
|
-
# Silences the warning, which says 'config.eager_load is set to nil'.
|
31
|
-
config.eager_load = false
|
32
|
-
|
33
|
-
routes.append do
|
34
|
-
get '/' => 'dummy#index'
|
35
|
-
get '/crash' => 'dummy#crash'
|
36
|
-
get '/breakdown' => 'dummy#breakdown'
|
37
|
-
get '/breakdown_view_only' => 'dummy#breakdown_view_only'
|
38
|
-
get '/breakdown_http' => 'dummy#breakdown_http'
|
39
|
-
get '/breakdown_curl_http' => 'dummy#breakdown_curl_http'
|
40
|
-
get '/breakdown_curl_http_easy' => 'dummy#breakdown_curl_http_easy'
|
41
|
-
get '/breakdown_curl_http_multi' => 'dummy#breakdown_curl_http_multi'
|
42
|
-
get '/breakdown_excon' => 'dummy#breakdown_excon'
|
43
|
-
get '/breakdown_http_rb' => 'dummy#breakdown_http_rb'
|
44
|
-
get '/breakdown_http_client' => 'dummy#breakdown_http_client'
|
45
|
-
get '/breakdown_typhoeus' => 'dummy#breakdown_typhoeus'
|
46
|
-
get '/notify_airbrake_helper' => 'dummy#notify_airbrake_helper'
|
47
|
-
get '/notify_airbrake_sync_helper' => 'dummy#notify_airbrake_sync_helper'
|
48
|
-
get '/active_record_after_commit' => 'dummy#active_record_after_commit'
|
49
|
-
get '/active_record_after_rollback' => 'dummy#active_record_after_rollback'
|
50
|
-
get '/active_job' => 'dummy#active_job'
|
51
|
-
get '/resque' => 'dummy#resque'
|
52
|
-
get '/delayed_job' => 'dummy#delayed_job'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class Book < ActiveRecord::Base
|
57
|
-
after_commit :raise_error_after_commit
|
58
|
-
after_rollback :raise_error_after_rollback
|
59
|
-
|
60
|
-
def raise_error_after_commit
|
61
|
-
raise AirbrakeTestError, 'after_commit'
|
62
|
-
end
|
63
|
-
|
64
|
-
def raise_error_after_rollback
|
65
|
-
raise AirbrakeTestError, 'after_rollback'
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# ActiveJob.
|
70
|
-
if Gem::Version.new(Rails.version) >= Gem::Version.new('4.2')
|
71
|
-
class BingoJob < ActiveJob::Base
|
72
|
-
queue_as :bingo
|
73
|
-
|
74
|
-
class BingoWrapper
|
75
|
-
def initialize(bingo)
|
76
|
-
@bingo = bingo
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def perform(*_args)
|
81
|
-
@wrapper = BingoWrapper.new(self)
|
82
|
-
raise AirbrakeTestError, 'active_job error'
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
# Resque.
|
88
|
-
class BingoWorker
|
89
|
-
@queue = :bingo_workers_queue
|
90
|
-
|
91
|
-
def self.perform(_bango, _bongo)
|
92
|
-
raise AirbrakeTestError, 'resque error'
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
# DelayedJob.
|
97
|
-
BangoJob = Struct.new(:bingo, :bongo) do
|
98
|
-
def perform
|
99
|
-
raise AirbrakeTestError, 'delayed_job error'
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
class DummyController < ActionController::Base
|
104
|
-
layout 'application'
|
105
|
-
|
106
|
-
self.view_paths = [
|
107
|
-
ActionView::FixtureResolver.new(
|
108
|
-
'layouts/application.html.erb' => '<%= yield %>',
|
109
|
-
'dummy/index.html.erb' => 'Hello from index',
|
110
|
-
'dummy/notify_airbrake_helper.html.erb' => 'notify_airbrake_helper',
|
111
|
-
'dummy/notify_airbrake_sync_helper.html.erb' => 'notify_airbrake_helper_sync',
|
112
|
-
'dummy/active_record_after_commit.html.erb' => 'active_record_after_commit',
|
113
|
-
'dummy/active_record_after_rollback.html.erb' => 'active_record_after_rollback',
|
114
|
-
'dummy/active_job.html.erb' => 'active_job',
|
115
|
-
'dummy/resque.html.erb' => 'resque',
|
116
|
-
'dummy/delayed_job.html.erb' => 'delayed_job',
|
117
|
-
'dummy/breakdown.html.erb' => 'breakdown',
|
118
|
-
'dummy/breakdown_view_only.html.erb' => 'breakdown_view_only',
|
119
|
-
'dummy/breakdown_http.html.erb' => 'breakdown_http',
|
120
|
-
'dummy/breakdown_curl_http.html.erb' => 'breakdown_curl_http',
|
121
|
-
'dummy/breakdown_curl_http_easy.html.erb' => 'breakdown_curl_http_easy',
|
122
|
-
'dummy/breakdown_curl_http_multi.html.erb' => 'breakdown_curl_http_multi',
|
123
|
-
'dummy/breakdown_excon.erb' => 'breakdown_excon',
|
124
|
-
'dummy/breakdown_http_rb.erb' => 'breakdown_http_rb',
|
125
|
-
'dummy/breakdown_http_client.erb' => 'breakdown_http_client',
|
126
|
-
'dummy/breakdown_typhoeus.erb' => 'breakdown_typhoeus'
|
127
|
-
)
|
128
|
-
]
|
129
|
-
|
130
|
-
def index; end
|
131
|
-
|
132
|
-
def crash
|
133
|
-
Book.create(title: 'book')
|
134
|
-
raise AirbrakeTestError
|
135
|
-
end
|
136
|
-
|
137
|
-
def breakdown
|
138
|
-
Book.create(title: 'breakdown')
|
139
|
-
Book.all
|
140
|
-
end
|
141
|
-
|
142
|
-
def breakdown_view_only
|
143
|
-
render 'dummy/breakdown.html.erb'
|
144
|
-
end
|
145
|
-
|
146
|
-
def breakdown_http
|
147
|
-
Net::HTTP.get('example.com', '/')
|
148
|
-
render 'dummy/breakdown_http.html.erb'
|
149
|
-
end
|
150
|
-
|
151
|
-
def breakdown_curl_http
|
152
|
-
Curl.get('example.com')
|
153
|
-
render 'dummy/breakdown_curl_http.html.erb'
|
154
|
-
end
|
155
|
-
|
156
|
-
def breakdown_curl_http_easy
|
157
|
-
Curl::Easy.perform('example.com')
|
158
|
-
render 'dummy/breakdown_curl_http_easy.html.erb'
|
159
|
-
end
|
160
|
-
|
161
|
-
def breakdown_curl_http_multi
|
162
|
-
Curl::Multi.get(['example.com'])
|
163
|
-
render 'dummy/breakdown_curl_http_multi.html.erb'
|
164
|
-
end
|
165
|
-
|
166
|
-
def breakdown_excon
|
167
|
-
Excon.get('http://example.com')
|
168
|
-
render 'dummy/breakdown_excon.html.erb'
|
169
|
-
end
|
170
|
-
|
171
|
-
def breakdown_http_rb
|
172
|
-
HTTP.get('http://example.com')
|
173
|
-
render 'dummy/breakdown_http_rb.html.erb'
|
174
|
-
end
|
175
|
-
|
176
|
-
def breakdown_http_client
|
177
|
-
HTTPClient.new.get('http://example.com')
|
178
|
-
render 'dummy/breakdown_http_client.html.erb'
|
179
|
-
end
|
180
|
-
|
181
|
-
def breakdown_typhoeus
|
182
|
-
Typhoeus.get('example.com')
|
183
|
-
render 'dummy/breakdown_typhoeus.html.erb'
|
184
|
-
end
|
185
|
-
|
186
|
-
def notify_airbrake_helper
|
187
|
-
notify_airbrake(AirbrakeTestError.new)
|
188
|
-
end
|
189
|
-
|
190
|
-
def notify_airbrake_sync_helper
|
191
|
-
notify_airbrake_sync(AirbrakeTestError.new)
|
192
|
-
end
|
193
|
-
|
194
|
-
def active_record_after_commit
|
195
|
-
Book.create(title: 'Bingo')
|
196
|
-
end
|
197
|
-
|
198
|
-
def active_record_after_rollback
|
199
|
-
Book.transaction do
|
200
|
-
Book.create(title: 'Bango')
|
201
|
-
raise ActiveRecord::Rollback
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
def active_job
|
206
|
-
BingoJob.perform_later('bango', 'bongo')
|
207
|
-
end
|
208
|
-
|
209
|
-
def resque
|
210
|
-
Resque.enqueue(BingoWorker, 'bango', 'bongo')
|
211
|
-
end
|
212
|
-
|
213
|
-
def delayed_job
|
214
|
-
Delayed::Job.enqueue(BangoJob.new('bingo', 'bongo'))
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
# Initializes middlewares and such.
|
219
|
-
DummyApp.initialize!
|
220
|
-
|
221
|
-
ActiveRecord::Base.connection.create_table(:books) do |t|
|
222
|
-
t.string(:title)
|
223
|
-
end
|
224
|
-
|
225
|
-
ActiveRecord::Migration.verbose = false
|
226
|
-
|
227
|
-
# Modified version of: https://goo.gl/q8uCJq
|
228
|
-
migration_template = File.open(
|
229
|
-
File.join(
|
230
|
-
$LOAD_PATH.grep(/delayed_job/)[0],
|
231
|
-
'generators/delayed_job/templates/migration.rb'
|
232
|
-
)
|
233
|
-
)
|
234
|
-
|
235
|
-
# need to eval the template with the migration_version intact
|
236
|
-
migration_context = Class.new do
|
237
|
-
# rubocop:disable Naming/AccessorMethodName
|
238
|
-
def get_binding
|
239
|
-
binding
|
240
|
-
end
|
241
|
-
# rubocop:enable Naming/AccessorMethodName
|
242
|
-
|
243
|
-
def migration_version
|
244
|
-
return unless ActiveRecord::VERSION::MAJOR >= 5
|
245
|
-
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
migration_ruby =
|
250
|
-
ERB.new(migration_template.read).result(migration_context.new.get_binding)
|
251
|
-
migration_template.close
|
252
|
-
# rubocop:disable Security/Eval
|
253
|
-
eval(migration_ruby)
|
254
|
-
# rubocop:enable Security/Eval
|
255
|
-
|
256
|
-
ActiveRecord::Schema.define do
|
257
|
-
CreateDelayedJobs.up
|
258
|
-
end
|