sentry-raven 3.0.1 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.craft.yml +2 -1
- data/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- data/.github/pull_request_template.md +16 -0
- data/.github/workflows/test.yml +41 -26
- data/.github/workflows/zeus_upload.yml +32 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -3
- data/{changelog.md → CHANGELOG.md} +157 -7
- data/CONTRIBUTING.md +71 -0
- data/Gemfile +5 -2
- data/README.md +29 -14
- data/lib/raven/backtrace.rb +2 -0
- data/lib/raven/base.rb +2 -0
- data/lib/raven/breadcrumbs/active_support_logger.rb +25 -0
- data/lib/raven/breadcrumbs/logger.rb +2 -92
- data/lib/raven/breadcrumbs/sentry_logger.rb +73 -0
- data/lib/raven/cli.rb +8 -19
- data/lib/raven/client.rb +1 -1
- data/lib/raven/configuration.rb +81 -5
- data/lib/raven/context.rb +13 -8
- data/lib/raven/core_ext/object/deep_dup.rb +57 -0
- data/lib/raven/core_ext/object/duplicable.rb +153 -0
- data/lib/raven/event.rb +23 -13
- data/lib/raven/helpers/deprecation_helper.rb +17 -0
- data/lib/raven/instance.rb +10 -1
- data/lib/raven/integrations/delayed_job.rb +2 -1
- data/lib/raven/integrations/rack-timeout.rb +5 -1
- data/lib/raven/integrations/rack.rb +15 -2
- data/lib/raven/integrations/rails.rb +12 -3
- data/lib/raven/integrations/rails/active_job.rb +2 -1
- data/lib/raven/integrations/rails/backtrace_cleaner.rb +29 -0
- data/lib/raven/integrations/sidekiq.rb +4 -78
- data/lib/raven/integrations/sidekiq/cleanup_middleware.rb +13 -0
- data/lib/raven/integrations/sidekiq/error_handler.rb +38 -0
- data/lib/raven/processor/cookies.rb +1 -1
- data/lib/raven/processor/removecircularreferences.rb +2 -1
- data/lib/raven/transports/http.rb +0 -2
- data/lib/raven/utils/context_filter.rb +42 -0
- data/lib/raven/version.rb +1 -1
- data/lib/sentry-raven-without-integrations.rb +6 -1
- data/lib/sentry_raven_without_integrations.rb +1 -0
- data/sentry-ruby/.gitignore +11 -0
- data/sentry-ruby/.rspec +3 -0
- data/sentry-ruby/.travis.yml +6 -0
- data/sentry-ruby/CODE_OF_CONDUCT.md +74 -0
- data/sentry-ruby/Gemfile +9 -0
- data/sentry-ruby/LICENSE.txt +21 -0
- data/sentry-ruby/README.md +44 -0
- data/sentry-ruby/Rakefile +6 -0
- data/sentry-ruby/bin/console +14 -0
- data/sentry-ruby/bin/setup +8 -0
- data/sentry-ruby/examples/rails-6.0/.browserslistrc +1 -0
- data/sentry-ruby/examples/rails-6.0/.gitignore +35 -0
- data/sentry-ruby/examples/rails-6.0/Gemfile +58 -0
- data/sentry-ruby/examples/rails-6.0/README.md +23 -0
- data/sentry-ruby/examples/rails-6.0/Rakefile +6 -0
- data/sentry-ruby/examples/rails-6.0/app/assets/config/manifest.js +2 -0
- data/sentry-ruby/examples/rails-6.0/app/assets/images/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/app/assets/stylesheets/application.css +15 -0
- data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/channel.rb +4 -0
- data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/connection.rb +4 -0
- data/sentry-ruby/examples/rails-6.0/app/controllers/application_controller.rb +2 -0
- data/sentry-ruby/examples/rails-6.0/app/controllers/concerns/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/app/controllers/welcome_controller.rb +23 -0
- data/sentry-ruby/examples/rails-6.0/app/helpers/application_helper.rb +2 -0
- data/sentry-ruby/examples/rails-6.0/app/javascript/channels/consumer.js +6 -0
- data/sentry-ruby/examples/rails-6.0/app/javascript/channels/index.js +5 -0
- data/sentry-ruby/examples/rails-6.0/app/javascript/packs/application.js +17 -0
- data/sentry-ruby/examples/rails-6.0/app/jobs/application_job.rb +7 -0
- data/sentry-ruby/examples/rails-6.0/app/mailers/application_mailer.rb +4 -0
- data/sentry-ruby/examples/rails-6.0/app/models/application_record.rb +3 -0
- data/sentry-ruby/examples/rails-6.0/app/models/concerns/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/app/views/layouts/application.html.erb +15 -0
- data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.html.erb +13 -0
- data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.text.erb +1 -0
- data/sentry-ruby/examples/rails-6.0/app/views/welcome/report_demo.html.erb +22 -0
- data/sentry-ruby/examples/rails-6.0/app/views/welcome/view_error.html.erb +1 -0
- data/sentry-ruby/examples/rails-6.0/app/workers/error_worker.rb +7 -0
- data/sentry-ruby/examples/rails-6.0/babel.config.js +72 -0
- data/sentry-ruby/examples/rails-6.0/bin/bundle +114 -0
- data/sentry-ruby/examples/rails-6.0/bin/rails +9 -0
- data/sentry-ruby/examples/rails-6.0/bin/rake +9 -0
- data/sentry-ruby/examples/rails-6.0/bin/setup +36 -0
- data/sentry-ruby/examples/rails-6.0/bin/spring +17 -0
- data/sentry-ruby/examples/rails-6.0/bin/webpack +18 -0
- data/sentry-ruby/examples/rails-6.0/bin/webpack-dev-server +18 -0
- data/sentry-ruby/examples/rails-6.0/bin/yarn +11 -0
- data/sentry-ruby/examples/rails-6.0/config.ru +5 -0
- data/sentry-ruby/examples/rails-6.0/config/application.rb +28 -0
- data/sentry-ruby/examples/rails-6.0/config/boot.rb +4 -0
- data/sentry-ruby/examples/rails-6.0/config/cable.yml +10 -0
- data/sentry-ruby/examples/rails-6.0/config/credentials.yml.enc +1 -0
- data/sentry-ruby/examples/rails-6.0/config/database.yml +25 -0
- data/sentry-ruby/examples/rails-6.0/config/environment.rb +5 -0
- data/sentry-ruby/examples/rails-6.0/config/environments/development.rb +62 -0
- data/sentry-ruby/examples/rails-6.0/config/environments/production.rb +112 -0
- data/sentry-ruby/examples/rails-6.0/config/environments/test.rb +48 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/application_controller_renderer.rb +8 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/assets.rb +14 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/backtrace_silencers.rb +7 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/content_security_policy.rb +30 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/cookies_serializer.rb +5 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/filter_parameter_logging.rb +4 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/inflections.rb +16 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/mime_types.rb +4 -0
- data/sentry-ruby/examples/rails-6.0/config/initializers/wrap_parameters.rb +14 -0
- data/sentry-ruby/examples/rails-6.0/config/locales/en.yml +33 -0
- data/sentry-ruby/examples/rails-6.0/config/puma.rb +38 -0
- data/sentry-ruby/examples/rails-6.0/config/routes.rb +10 -0
- data/sentry-ruby/examples/rails-6.0/config/spring.rb +6 -0
- data/sentry-ruby/examples/rails-6.0/config/storage.yml +34 -0
- data/sentry-ruby/examples/rails-6.0/config/webpack/development.js +5 -0
- data/sentry-ruby/examples/rails-6.0/config/webpack/environment.js +3 -0
- data/sentry-ruby/examples/rails-6.0/config/webpack/production.js +5 -0
- data/sentry-ruby/examples/rails-6.0/config/webpack/test.js +5 -0
- data/sentry-ruby/examples/rails-6.0/config/webpacker.yml +96 -0
- data/sentry-ruby/examples/rails-6.0/db/seeds.rb +7 -0
- data/sentry-ruby/examples/rails-6.0/lib/assets/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/lib/tasks/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/package.json +15 -0
- data/sentry-ruby/examples/rails-6.0/postcss.config.js +12 -0
- data/sentry-ruby/examples/rails-6.0/public/404.html +67 -0
- data/sentry-ruby/examples/rails-6.0/public/422.html +67 -0
- data/sentry-ruby/examples/rails-6.0/public/500.html +66 -0
- data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon-precomposed.png +0 -0
- data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon.png +0 -0
- data/sentry-ruby/examples/rails-6.0/public/favicon.ico +0 -0
- data/sentry-ruby/examples/rails-6.0/public/robots.txt +1 -0
- data/sentry-ruby/examples/rails-6.0/storage/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/application_system_test_case.rb +5 -0
- data/sentry-ruby/examples/rails-6.0/test/channels/application_cable/connection_test.rb +11 -0
- data/sentry-ruby/examples/rails-6.0/test/controllers/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/fixtures/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/fixtures/files/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/helpers/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/integration/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/mailers/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/models/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/system/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/test_helper.rb +13 -0
- data/sentry-ruby/examples/rails-6.0/vendor/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/yarn.lock +7508 -0
- data/sentry-ruby/lib/sentry.rb +16 -0
- data/sentry-ruby/lib/sentry/backtrace.rb +128 -0
- data/sentry-ruby/lib/sentry/client.rb +162 -0
- data/sentry-ruby/lib/sentry/client/state.rb +40 -0
- data/sentry-ruby/lib/sentry/configuration.rb +533 -0
- data/sentry-ruby/lib/sentry/event.rb +209 -0
- data/sentry-ruby/lib/sentry/interface.rb +31 -0
- data/sentry-ruby/lib/sentry/interfaces/exception.rb +15 -0
- data/sentry-ruby/lib/sentry/interfaces/http.rb +16 -0
- data/sentry-ruby/lib/sentry/interfaces/message.rb +18 -0
- data/sentry-ruby/lib/sentry/interfaces/single_exception.rb +14 -0
- data/sentry-ruby/lib/sentry/interfaces/stack_trace.rb +69 -0
- data/sentry-ruby/lib/sentry/linecache.rb +44 -0
- data/sentry-ruby/lib/sentry/logger.rb +20 -0
- data/sentry-ruby/lib/sentry/transports.rb +19 -0
- data/sentry-ruby/lib/sentry/transports/dummy.rb +16 -0
- data/sentry-ruby/lib/sentry/transports/http.rb +66 -0
- data/sentry-ruby/lib/sentry/transports/stdout.rb +20 -0
- data/sentry-ruby/lib/sentry/utils/deep_merge.rb +22 -0
- data/sentry-ruby/lib/sentry/utils/exception_cause_chain.rb +20 -0
- data/sentry-ruby/lib/sentry/version.rb +3 -0
- data/sentry-ruby/sentry-ruby.gemspec +26 -0
- data/sentry-ruby/spec/sentry/backtrace_spec.rb +38 -0
- data/sentry-ruby/spec/sentry/client_spec.rb +443 -0
- data/sentry-ruby/spec/sentry/configuration_spec.rb +400 -0
- data/sentry-ruby/spec/sentry/event_spec.rb +238 -0
- data/sentry-ruby/spec/sentry/interface_spec.rb +38 -0
- data/sentry-ruby/spec/sentry/interfaces/stack_trace_spec.rb +11 -0
- data/sentry-ruby/spec/sentry/linecache_spec.rb +40 -0
- data/sentry-ruby/spec/sentry/transports/http_spec.rb +57 -0
- data/sentry-ruby/spec/sentry/transports/stdout_spec.rb +11 -0
- data/sentry-ruby/spec/sentry_spec.rb +9 -0
- data/sentry-ruby/spec/spec_helper.rb +49 -0
- data/sentry-ruby/spec/support/linecache.txt +6 -0
- metadata +152 -4
- data/lib/raven/breadcrumbs/activesupport.rb +0 -19
@@ -5,6 +5,7 @@ module Raven
|
|
5
5
|
require 'raven/integrations/rails/overrides/streaming_reporter'
|
6
6
|
require 'raven/integrations/rails/controller_methods'
|
7
7
|
require 'raven/integrations/rails/controller_transaction'
|
8
|
+
require 'raven/integrations/rails/backtrace_cleaner'
|
8
9
|
require 'raven/integrations/rack'
|
9
10
|
|
10
11
|
initializer "raven.use_rack_middleware" do |app|
|
@@ -37,12 +38,20 @@ module Raven
|
|
37
38
|
|
38
39
|
config.before_initialize do
|
39
40
|
Raven.configuration.logger = ::Rails.logger
|
41
|
+
|
42
|
+
backtrace_cleaner = Raven::Rails::BacktraceCleaner.new
|
43
|
+
|
44
|
+
Raven.configuration.backtrace_cleanup_callback = lambda do |backtrace|
|
45
|
+
backtrace_cleaner.clean(backtrace)
|
46
|
+
end
|
40
47
|
end
|
41
48
|
|
42
49
|
config.after_initialize do
|
43
|
-
if Raven.configuration.
|
44
|
-
|
45
|
-
|
50
|
+
if Raven.configuration.breadcrumbs_logger.include?(:active_support_logger) ||
|
51
|
+
Raven.configuration.rails_activesupport_breadcrumbs
|
52
|
+
|
53
|
+
require 'raven/breadcrumbs/active_support_logger'
|
54
|
+
Raven::Breadcrumbs::ActiveSupportLogger.inject
|
46
55
|
end
|
47
56
|
|
48
57
|
if Raven.configuration.rails_report_rescued_exceptions
|
@@ -21,7 +21,8 @@ module Raven
|
|
21
21
|
def capture_and_reraise_with_sentry(job, block)
|
22
22
|
block.call
|
23
23
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
24
|
-
|
24
|
+
rescue_handler_result = rescue_with_handler(e)
|
25
|
+
return rescue_handler_result if rescue_handler_result
|
25
26
|
|
26
27
|
Raven.capture_exception(e, :extra => raven_context(job))
|
27
28
|
raise e
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "active_support/backtrace_cleaner"
|
2
|
+
require "active_support/core_ext/string/access"
|
3
|
+
|
4
|
+
module Raven
|
5
|
+
class Rails
|
6
|
+
class BacktraceCleaner < ActiveSupport::BacktraceCleaner
|
7
|
+
APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/.freeze
|
8
|
+
RENDER_TEMPLATE_PATTERN = /:in `.*_\w+_{2,3}\d+_\d+'/.freeze
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super
|
12
|
+
# we don't want any default silencers because they're too aggressive
|
13
|
+
remove_silencers!
|
14
|
+
|
15
|
+
@root = "#{Raven.configuration.project_root}/"
|
16
|
+
add_filter do |line|
|
17
|
+
line.start_with?(@root) ? line.from(@root.size) : line
|
18
|
+
end
|
19
|
+
add_filter do |line|
|
20
|
+
if line =~ RENDER_TEMPLATE_PATTERN
|
21
|
+
line.sub(RENDER_TEMPLATE_PATTERN, "")
|
22
|
+
else
|
23
|
+
line
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,87 +1,13 @@
|
|
1
1
|
require 'time'
|
2
2
|
require 'sidekiq'
|
3
|
-
|
4
|
-
|
5
|
-
class SidekiqCleanupMiddleware
|
6
|
-
def call(_worker, job, queue)
|
7
|
-
Raven.context.transaction.push "Sidekiq/#{job['class']}"
|
8
|
-
Raven.extra_context(:sidekiq => job.merge("queue" => queue))
|
9
|
-
yield
|
10
|
-
Context.clear!
|
11
|
-
BreadcrumbBuffer.clear!
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class SidekiqErrorHandler
|
16
|
-
ACTIVEJOB_RESERVED_PREFIX = "_aj_".freeze
|
17
|
-
HAS_GLOBALID = const_defined?('GlobalID')
|
18
|
-
|
19
|
-
def call(ex, context)
|
20
|
-
context = filter_context(context)
|
21
|
-
Raven.context.transaction.push transaction_from_context(context)
|
22
|
-
Raven.capture_exception(
|
23
|
-
ex,
|
24
|
-
:message => ex.message,
|
25
|
-
:extra => { :sidekiq => context }
|
26
|
-
)
|
27
|
-
Context.clear!
|
28
|
-
BreadcrumbBuffer.clear!
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
# Once an ActiveJob is queued, ActiveRecord references get serialized into
|
34
|
-
# some internal reserved keys, such as _aj_globalid.
|
35
|
-
#
|
36
|
-
# The problem is, if this job in turn gets queued back into ActiveJob with
|
37
|
-
# these magic reserved keys, ActiveJob will throw up and error. We want to
|
38
|
-
# capture these and mutate the keys so we can sanely report it.
|
39
|
-
def filter_context(context)
|
40
|
-
case context
|
41
|
-
when Array
|
42
|
-
context.map { |arg| filter_context(arg) }
|
43
|
-
when Hash
|
44
|
-
Hash[context.map { |key, value| filter_context_hash(key, value) }]
|
45
|
-
else
|
46
|
-
format_globalid(context)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def filter_context_hash(key, value)
|
51
|
-
(key = key[3..-1]) if key [0..3] == ACTIVEJOB_RESERVED_PREFIX
|
52
|
-
[key, filter_context(value)]
|
53
|
-
end
|
54
|
-
|
55
|
-
# this will change in the future:
|
56
|
-
# https://github.com/mperham/sidekiq/pull/3161
|
57
|
-
def transaction_from_context(context)
|
58
|
-
classname = (context["wrapped"] || context["class"] ||
|
59
|
-
(context[:job] && (context[:job]["wrapped"] || context[:job]["class"]))
|
60
|
-
)
|
61
|
-
if classname
|
62
|
-
"Sidekiq/#{classname}"
|
63
|
-
elsif context[:event]
|
64
|
-
"Sidekiq/#{context[:event]}"
|
65
|
-
else
|
66
|
-
"Sidekiq"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def format_globalid(context)
|
71
|
-
if HAS_GLOBALID && context.is_a?(GlobalID)
|
72
|
-
context.to_s
|
73
|
-
else
|
74
|
-
context
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
3
|
+
require 'raven/integrations/sidekiq/cleanup_middleware'
|
4
|
+
require 'raven/integrations/sidekiq/error_handler'
|
79
5
|
|
80
6
|
if Sidekiq::VERSION > '3'
|
81
7
|
Sidekiq.configure_server do |config|
|
82
|
-
config.error_handlers << Raven::
|
8
|
+
config.error_handlers << Raven::Sidekiq::ErrorHandler.new
|
83
9
|
config.server_middleware do |chain|
|
84
|
-
chain.add Raven::
|
10
|
+
chain.add Raven::Sidekiq::CleanupMiddleware
|
85
11
|
end
|
86
12
|
end
|
87
13
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Raven
|
2
|
+
module Sidekiq
|
3
|
+
class CleanupMiddleware
|
4
|
+
def call(_worker, job, queue)
|
5
|
+
Raven.context.transaction.push "Sidekiq/#{job['class']}"
|
6
|
+
Raven.extra_context(:sidekiq => job.merge("queue" => queue))
|
7
|
+
yield
|
8
|
+
Context.clear!
|
9
|
+
BreadcrumbBuffer.clear!
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'raven/utils/context_filter'
|
2
|
+
|
3
|
+
module Raven
|
4
|
+
module Sidekiq
|
5
|
+
class ErrorHandler
|
6
|
+
SIDEKIQ_NAME = "Sidekiq".freeze
|
7
|
+
|
8
|
+
def call(ex, context)
|
9
|
+
context = Utils::ContextFilter.filter_context(context)
|
10
|
+
Raven.context.transaction.push transaction_from_context(context)
|
11
|
+
Raven.capture_exception(
|
12
|
+
ex,
|
13
|
+
:message => ex.message,
|
14
|
+
:extra => { :sidekiq => context }
|
15
|
+
)
|
16
|
+
Context.clear!
|
17
|
+
BreadcrumbBuffer.clear!
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# this will change in the future:
|
23
|
+
# https://github.com/mperham/sidekiq/pull/3161
|
24
|
+
def transaction_from_context(context)
|
25
|
+
classname = (context["wrapped"] || context["class"] ||
|
26
|
+
(context[:job] && (context[:job]["wrapped"] || context[:job]["class"]))
|
27
|
+
)
|
28
|
+
if classname
|
29
|
+
"#{SIDEKIQ_NAME}/#{classname}"
|
30
|
+
elsif context[:event]
|
31
|
+
"#{SIDEKIQ_NAME}/#{context[:event]}"
|
32
|
+
else
|
33
|
+
SIDEKIQ_NAME
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Raven
|
2
2
|
class Processor::RemoveCircularReferences < Processor
|
3
|
+
ELISION_STRING = "(...)".freeze
|
3
4
|
def process(value, visited = [])
|
4
|
-
return
|
5
|
+
return ELISION_STRING if visited.include?(value.__id__)
|
5
6
|
|
6
7
|
visited << value.__id__ if value.is_a?(Array) || value.is_a?(Hash)
|
7
8
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Raven
|
2
|
+
module Utils
|
3
|
+
module ContextFilter
|
4
|
+
class << self
|
5
|
+
ACTIVEJOB_RESERVED_PREFIX_REGEX = /^_aj_/.freeze
|
6
|
+
HAS_GLOBALID = const_defined?('GlobalID')
|
7
|
+
|
8
|
+
# Once an ActiveJob is queued, ActiveRecord references get serialized into
|
9
|
+
# some internal reserved keys, such as _aj_globalid.
|
10
|
+
#
|
11
|
+
# The problem is, if this job in turn gets queued back into ActiveJob with
|
12
|
+
# these magic reserved keys, ActiveJob will throw up and error. We want to
|
13
|
+
# capture these and mutate the keys so we can sanely report it.
|
14
|
+
def filter_context(context)
|
15
|
+
case context
|
16
|
+
when Array
|
17
|
+
context.map { |arg| filter_context(arg) }
|
18
|
+
when Hash
|
19
|
+
Hash[context.map { |key, value| filter_context_hash(key, value) }]
|
20
|
+
else
|
21
|
+
format_globalid(context)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def filter_context_hash(key, value)
|
28
|
+
key = key.to_s.sub(ACTIVEJOB_RESERVED_PREFIX_REGEX, "") if key.match(ACTIVEJOB_RESERVED_PREFIX_REGEX)
|
29
|
+
[key, filter_context(value)]
|
30
|
+
end
|
31
|
+
|
32
|
+
def format_globalid(context)
|
33
|
+
if HAS_GLOBALID && context.is_a?(GlobalID)
|
34
|
+
context.to_s
|
35
|
+
else
|
36
|
+
context
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/raven/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require 'raven/base'
|
data/sentry-ruby/.rspec
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at stan001212@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/sentry-ruby/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 st0012
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Sentry::Ruby
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sentry/ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'sentry-ruby'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install sentry-ruby
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sentry-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/sentry-ruby/blob/master/CODE_OF_CONDUCT.md).
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the Sentry::Ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/sentry-ruby/blob/master/CODE_OF_CONDUCT.md).
|