sentry-rails 4.5.0 → 4.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dacfb4f5f23d9d37bef25d05d7c7c6783e6c0e5578e706112ed5e69f9314a54
4
- data.tar.gz: e78a4adf974cc0b9769e8b8bcf9dcf92a920548f5811ec7f4aeeb65d0ca73493
3
+ metadata.gz: 45db4da3ec4c8f0b06f535beadd58051516a0acabe75f5536445117f644abddf
4
+ data.tar.gz: 29f21dc64916654597023ae87a6d83b878c439ebf67b37bf2423c819093011f2
5
5
  SHA512:
6
- metadata.gz: d79b9b8b316ac7af02a138b81bfa7a303c6f18e4a6edd5f75101b9d6e1ff93ec6ab5290ae163eca98b4dfba89631f9c0710b6405eb3c123bc3fbec94480ee297
7
- data.tar.gz: 4fb8951a0bd157f59b0b969f8b3745873f93c1bb75d1d4824d959330e4c1565613b01c42b7ca92627e3a305c5dc085940b2ca7cc8ae735011dbe483e8e6f1237
6
+ metadata.gz: 68b3e9718c9b2f24a30a904f57fabd91430d3d6332a28e957dab32d25097066e0b0390e35433f81d8196122230f74ab68aac9a8ccad0daef4e5193dbddc1c9dd
7
+ data.tar.gz: 893bb7f6f7b9625787bbaeb9bf6281f707da7050d63922d665a5d3cc8da2a74189d040639e88f9fca7cd5182dd19f5c471ae6d82ce381878cd42eea3820233ad
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in sentry-ruby.gemspec
4
4
  gemspec
5
+ gem "sentry-ruby", path: "../sentry-ruby"
5
6
 
6
7
  rails_version = ENV["RAILS_VERSION"]
7
8
  rails_version = "6.1.0" if rails_version.nil?
@@ -18,6 +19,8 @@ end
18
19
  gem "rails", "~> #{rails_version}"
19
20
  gem "sprockets-rails"
20
21
 
22
+ gem "sidekiq"
23
+
21
24
  gem "rspec", "~> 3.0"
22
25
  gem "rspec-retry"
23
26
  gem "rspec-rails", "~> 4.0"
@@ -25,13 +28,8 @@ gem "codecov", "0.2.12"
25
28
 
26
29
  gem "rake", "~> 12.0"
27
30
 
28
- # TODO: Remove this if https://github.com/jruby/jruby/issues/6547 is addressed
29
- gem "i18n", "<= 1.8.7"
30
-
31
- gem "sidekiq"
32
-
33
- gem "sentry-ruby", path: "../sentry-ruby"
34
-
31
+ gem "object_tracer"
32
+ gem "debug", github: "ruby/debug" if RUBY_VERSION.to_f >= 2.6
35
33
  gem "pry"
36
34
 
37
35
  gem "benchmark-ips"
data/Rakefile CHANGED
@@ -5,4 +5,10 @@ RSpec::Core::RakeTask.new(:spec).tap do |task|
5
5
  task.rspec_opts = "--order rand"
6
6
  end
7
7
 
8
- task :default => :spec
8
+ task :isolated_specs do
9
+ Dir["spec/isolated/*"].each do |file|
10
+ sh "bundle exec ruby #{file}"
11
+ end
12
+ end
13
+
14
+ task :default => [:spec, :isolated_specs]
@@ -1,9 +1,11 @@
1
+ require "sentry/rails/instrument_payload_cleanup_helper"
2
+
1
3
  module Sentry
2
4
  module Rails
3
5
  module Breadcrumb
4
6
  module ActiveSupportLogger
5
7
  class << self
6
- IGNORED_DATA_TYPES = [:request, :headers, :exception, :exception_object]
8
+ include InstrumentPayloadCleanupHelper
7
9
 
8
10
  def add(name, started, _finished, _unique_id, data)
9
11
  # skip Rails' internal events
@@ -23,12 +25,6 @@ module Sentry
23
25
  Sentry.add_breadcrumb(crumb)
24
26
  end
25
27
 
26
- def cleanup_data(data)
27
- IGNORED_DATA_TYPES.each do |key|
28
- data.delete(key) if data.key?(key)
29
- end
30
- end
31
-
32
28
  def inject
33
29
  @subscriber = ::ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
34
30
  # we only record events that has a started timestamp
@@ -0,0 +1,13 @@
1
+ module Sentry
2
+ module Rails
3
+ module InstrumentPayloadCleanupHelper
4
+ IGNORED_DATA_TYPES = [:request, :response, :headers, :exception, :exception_object]
5
+
6
+ def cleanup_data(data)
7
+ IGNORED_DATA_TYPES.each do |key|
8
+ data.delete(key) if data.key?(key)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -12,13 +12,22 @@ module Sentry
12
12
  app.config.middleware.use(Sentry::Rails::RescuedExceptionInterceptor)
13
13
  end
14
14
 
15
+ # because the extension works by registering the around_perform callcack, it should always be ran
16
+ # before the application is eager-loaded (before user's jobs register their own callbacks)
17
+ # See https://github.com/getsentry/sentry-ruby/issues/1249#issuecomment-853871871 for the detail explanation
18
+ initializer "sentry.extend_active_job", before: :eager_load! do |app|
19
+ ActiveSupport.on_load(:active_job) do
20
+ require "sentry/rails/active_job"
21
+ prepend Sentry::Rails::ActiveJobExtensions
22
+ end
23
+ end
24
+
15
25
  config.after_initialize do |app|
16
26
  next unless Sentry.initialized?
17
27
 
18
28
  configure_project_root
19
29
  configure_trusted_proxies
20
30
  extend_controller_methods if defined?(ActionController)
21
- extend_active_job if defined?(ActiveJob)
22
31
  patch_background_worker if defined?(ActiveRecord)
23
32
  override_streaming_reporter if defined?(ActionView)
24
33
  setup_backtrace_cleanup_callback
@@ -39,11 +48,6 @@ module Sentry
39
48
  Sentry.configuration.trusted_proxies += Array(::Rails.application.config.action_dispatch.trusted_proxies)
40
49
  end
41
50
 
42
- def extend_active_job
43
- require "sentry/rails/active_job"
44
- ActiveJob::Base.send(:prepend, Sentry::Rails::ActiveJobExtensions)
45
- end
46
-
47
51
  def extend_controller_methods
48
52
  require "sentry/rails/controller_methods"
49
53
  require "sentry/rails/controller_transaction"
@@ -1,9 +1,12 @@
1
1
  require "sentry/rails/tracing/abstract_subscriber"
2
+ require "sentry/rails/instrument_payload_cleanup_helper"
2
3
 
3
4
  module Sentry
4
5
  module Rails
5
6
  module Tracing
6
7
  class ActionControllerSubscriber < AbstractSubscriber
8
+ extend InstrumentPayloadCleanupHelper
9
+
7
10
  EVENT_NAME = "process_action.action_controller".freeze
8
11
 
9
12
  def self.subscribe!
@@ -18,8 +21,7 @@ module Sentry
18
21
  duration: duration
19
22
  ) do |span|
20
23
  payload = payload.dup
21
- payload.delete(:headers)
22
- payload.delete(:request)
24
+ cleanup_data(payload)
23
25
  span.set_data(:payload, payload)
24
26
  span.set_http_status(payload[:status])
25
27
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "4.5.0"
3
+ VERSION = "4.6.1"
4
4
  end
5
5
  end
data/sentry-rails.gemspec CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "railties", ">= 5.0"
26
- spec.add_dependency "sentry-ruby-core", "~> 4.5.0"
26
+ spec.add_dependency "sentry-ruby-core", "~> 4.6.0"
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-27 00:00:00.000000000 Z
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.5.0
33
+ version: 4.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.5.0
40
+ version: 4.6.0
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []
@@ -46,7 +46,6 @@ extra_rdoc_files:
46
46
  - README.md
47
47
  - LICENSE.txt
48
48
  files:
49
- - ".craft.yml"
50
49
  - ".gitignore"
51
50
  - ".rspec"
52
51
  - CHANGELOG.md
@@ -70,6 +69,7 @@ files:
70
69
  - lib/sentry/rails/controller_methods.rb
71
70
  - lib/sentry/rails/controller_transaction.rb
72
71
  - lib/sentry/rails/engine.rb
72
+ - lib/sentry/rails/instrument_payload_cleanup_helper.rb
73
73
  - lib/sentry/rails/overrides/streaming_reporter.rb
74
74
  - lib/sentry/rails/railtie.rb
75
75
  - lib/sentry/rails/rescued_exception_interceptor.rb
data/.craft.yml DELETED
@@ -1,19 +0,0 @@
1
- minVersion: '0.13.2'
2
- github:
3
- owner: getsentry
4
- repo: sentry-ruby
5
- changelogPolicy: simple
6
- preReleaseCommand: ruby ../.scripts/bump-version.rb
7
- releaseBranchPrefix: release-sentry-rails
8
- statusProvider:
9
- name: github
10
- artifactProvider:
11
- name: github
12
- targets:
13
- - name: gem
14
- - name: registry
15
- type: sdk
16
- config:
17
- canonical: 'gem:sentry-rails'
18
- - name: github
19
- tagPrefix: sentry-rails-v