sentry-raven 3.0.2 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.craft.yml +9 -5
  3. data/.scripts/bump-version.rb +5 -0
  4. data/{changelog.md → CHANGELOG.md} +165 -8
  5. data/Gemfile +10 -3
  6. data/Makefile +3 -0
  7. data/README.md +42 -15
  8. data/lib/raven/backtrace.rb +2 -0
  9. data/lib/raven/base.rb +3 -0
  10. data/lib/raven/breadcrumbs/active_support_logger.rb +25 -0
  11. data/lib/raven/breadcrumbs/logger.rb +2 -92
  12. data/lib/raven/breadcrumbs/sentry_logger.rb +73 -0
  13. data/lib/raven/cli.rb +8 -19
  14. data/lib/raven/client.rb +1 -1
  15. data/lib/raven/configuration.rb +80 -5
  16. data/lib/raven/context.rb +13 -8
  17. data/lib/raven/core_ext/object/deep_dup.rb +57 -0
  18. data/lib/raven/core_ext/object/duplicable.rb +153 -0
  19. data/lib/raven/event.rb +27 -13
  20. data/lib/raven/helpers/deprecation_helper.rb +17 -0
  21. data/lib/raven/instance.rb +17 -2
  22. data/lib/raven/integrations/delayed_job.rb +2 -1
  23. data/lib/raven/integrations/rack-timeout.rb +5 -1
  24. data/lib/raven/integrations/rack.rb +5 -4
  25. data/lib/raven/integrations/rails.rb +12 -3
  26. data/lib/raven/integrations/rails/active_job.rb +2 -1
  27. data/lib/raven/integrations/rails/backtrace_cleaner.rb +29 -0
  28. data/lib/raven/integrations/sidekiq.rb +4 -78
  29. data/lib/raven/integrations/sidekiq/cleanup_middleware.rb +13 -0
  30. data/lib/raven/integrations/sidekiq/error_handler.rb +38 -0
  31. data/lib/raven/processor/cookies.rb +1 -1
  32. data/lib/raven/processor/removecircularreferences.rb +2 -1
  33. data/lib/raven/transports/http.rb +2 -3
  34. data/lib/raven/utils/context_filter.rb +42 -0
  35. data/lib/raven/utils/request_id.rb +16 -0
  36. data/lib/raven/version.rb +1 -1
  37. data/lib/sentry-raven-without-integrations.rb +6 -1
  38. data/lib/sentry_raven_without_integrations.rb +1 -0
  39. data/sentry-raven.gemspec +7 -0
  40. metadata +21 -11
  41. data/.github/workflows/test.yml +0 -77
  42. data/.gitignore +0 -15
  43. data/.gitmodules +0 -0
  44. data/.rspec +0 -1
  45. data/.rubocop.yml +0 -109
  46. data/.scripts/bump-version.sh +0 -9
  47. data/lib/raven/breadcrumbs/activesupport.rb +0 -19
@@ -30,7 +30,7 @@ module Raven
30
30
  end
31
31
 
32
32
  def generate_masked_cookies(cookies)
33
- cookies.merge(cookies) { STRING_MASK }
33
+ cookies.merge(cookies) { STRING_MASK } if cookies.respond_to?(:merge)
34
34
  end
35
35
  end
36
36
  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 "(...)" if visited.include?(value.__id__)
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
 
@@ -1,7 +1,5 @@
1
1
  require 'faraday'
2
2
 
3
- require 'raven/transports'
4
-
5
3
  module Raven
6
4
  module Transports
7
5
  class HTTP < Transport
@@ -15,7 +13,8 @@ module Raven
15
13
 
16
14
  def send_event(auth_header, data, options = {})
17
15
  unless configuration.sending_allowed?
18
- logger.debug("Event not sent: #{configuration.error_messages}")
16
+ configuration.logger.debug("Event not sent: #{configuration.error_messages}")
17
+ return
19
18
  end
20
19
 
21
20
  project_id = configuration[:project_id]
@@ -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
@@ -0,0 +1,16 @@
1
+ module Raven
2
+ module Utils
3
+ module RequestId
4
+ REQUEST_ID_HEADERS = %w(action_dispatch.request_id HTTP_X_REQUEST_ID).freeze
5
+
6
+ # Request ID based on ActionDispatch::RequestId
7
+ def self.read_from(env_hash)
8
+ REQUEST_ID_HEADERS.each do |key|
9
+ request_id = env_hash[key]
10
+ return request_id if request_id
11
+ end
12
+ nil
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/raven/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raven
4
- VERSION = "3.0.2"
4
+ VERSION = "3.1.2"
5
5
  end
@@ -1 +1,6 @@
1
- require 'raven/base'
1
+ require "raven/helpers/deprecation_helper"
2
+
3
+ filename = "sentry_raven_without_integrations"
4
+ DeprecationHelper.deprecate_dasherized_filename(filename)
5
+
6
+ require filename
@@ -0,0 +1 @@
1
+ require 'raven/base'
data/sentry-raven.gemspec CHANGED
@@ -18,4 +18,11 @@ Gem::Specification.new do |gem|
18
18
  gem.executables = "raven"
19
19
 
20
20
  gem.add_dependency "faraday", ">= 1.0"
21
+
22
+ gem.post_install_message = <<~EOS
23
+ `sentry-raven` is deprecated! Please migrate to `sentry-ruby`
24
+
25
+ See https://docs.sentry.io/platforms/ruby/migration for the migration guide.
26
+
27
+ EOS
21
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -34,35 +34,36 @@ extra_rdoc_files:
34
34
  - LICENSE
35
35
  files:
36
36
  - ".craft.yml"
37
- - ".github/workflows/test.yml"
38
- - ".gitignore"
39
- - ".gitmodules"
40
- - ".rspec"
41
- - ".rubocop.yml"
42
- - ".scripts/bump-version.sh"
37
+ - ".scripts/bump-version.rb"
38
+ - CHANGELOG.md
43
39
  - Gemfile
44
40
  - LICENSE
41
+ - Makefile
45
42
  - README.md
46
43
  - Rakefile
47
- - changelog.md
48
44
  - exe/raven
49
45
  - lib/raven.rb
50
46
  - lib/raven/backtrace.rb
51
47
  - lib/raven/base.rb
52
48
  - lib/raven/breadcrumbs.rb
53
- - lib/raven/breadcrumbs/activesupport.rb
49
+ - lib/raven/breadcrumbs/active_support_logger.rb
54
50
  - lib/raven/breadcrumbs/logger.rb
51
+ - lib/raven/breadcrumbs/sentry_logger.rb
55
52
  - lib/raven/cli.rb
56
53
  - lib/raven/client.rb
57
54
  - lib/raven/configuration.rb
58
55
  - lib/raven/context.rb
56
+ - lib/raven/core_ext/object/deep_dup.rb
57
+ - lib/raven/core_ext/object/duplicable.rb
59
58
  - lib/raven/event.rb
59
+ - lib/raven/helpers/deprecation_helper.rb
60
60
  - lib/raven/instance.rb
61
61
  - lib/raven/integrations/delayed_job.rb
62
62
  - lib/raven/integrations/rack-timeout.rb
63
63
  - lib/raven/integrations/rack.rb
64
64
  - lib/raven/integrations/rails.rb
65
65
  - lib/raven/integrations/rails/active_job.rb
66
+ - lib/raven/integrations/rails/backtrace_cleaner.rb
66
67
  - lib/raven/integrations/rails/controller_methods.rb
67
68
  - lib/raven/integrations/rails/controller_transaction.rb
68
69
  - lib/raven/integrations/rails/overrides/debug_exceptions_catcher.rb
@@ -70,6 +71,8 @@ files:
70
71
  - lib/raven/integrations/railties.rb
71
72
  - lib/raven/integrations/rake.rb
72
73
  - lib/raven/integrations/sidekiq.rb
74
+ - lib/raven/integrations/sidekiq/cleanup_middleware.rb
75
+ - lib/raven/integrations/sidekiq/error_handler.rb
73
76
  - lib/raven/integrations/tasks.rb
74
77
  - lib/raven/interface.rb
75
78
  - lib/raven/interfaces/exception.rb
@@ -91,18 +94,25 @@ files:
91
94
  - lib/raven/transports/dummy.rb
92
95
  - lib/raven/transports/http.rb
93
96
  - lib/raven/transports/stdout.rb
97
+ - lib/raven/utils/context_filter.rb
94
98
  - lib/raven/utils/deep_merge.rb
95
99
  - lib/raven/utils/exception_cause_chain.rb
96
100
  - lib/raven/utils/real_ip.rb
101
+ - lib/raven/utils/request_id.rb
97
102
  - lib/raven/version.rb
98
103
  - lib/sentry-raven-without-integrations.rb
99
104
  - lib/sentry-raven.rb
105
+ - lib/sentry_raven_without_integrations.rb
100
106
  - sentry-raven.gemspec
101
107
  homepage: https://github.com/getsentry/raven-ruby
102
108
  licenses:
103
109
  - Apache-2.0
104
110
  metadata: {}
105
- post_install_message:
111
+ post_install_message: |+
112
+ `sentry-raven` is deprecated! Please migrate to `sentry-ruby`
113
+
114
+ See https://docs.sentry.io/platforms/ruby/migration for the migration guide.
115
+
106
116
  rdoc_options: []
107
117
  require_paths:
108
118
  - lib
@@ -1,77 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- - release/**
8
- pull_request:
9
- jobs:
10
- test:
11
- name: Test on ruby ${{ matrix.ruby_version }} and rails ${{ matrix.rails_version }}
12
- runs-on: ${{ matrix.os }}
13
- strategy:
14
- matrix:
15
- rails_version: [0, 4.2, 5.2, 6.0]
16
- ruby_version: [2.3, 2.4, 2.5, 2.6, 2.7, jruby, head]
17
- os: [ubuntu-latest]
18
- include:
19
- - ruby_version: head
20
- rails_version: 0
21
- - ruby_version: 2.7
22
- rails_version: 6.0
23
- env: RUBYOPT="--enable-frozen-string-literal --debug=frozen-string-literal"
24
- exclude:
25
- - ruby_version: 2.3
26
- rails_version: 6.0
27
- - ruby_version: 2.4
28
- rails_version: 6.0
29
- - ruby_version: 2.7
30
- rails_version: 4.2
31
- - ruby_version: head
32
- rails_version: 4.2
33
- - ruby_version: head
34
- rails_version: 5.2
35
- - ruby_version: head
36
- rails_version: 6.0
37
-
38
- steps:
39
- - uses: actions/checkout@v1
40
-
41
- - name: Set up Ruby ${{ matrix.ruby_version }}
42
- uses: ruby/setup-ruby@v1
43
- with:
44
- bundler: 1
45
- ruby-version: ${{ matrix.ruby_version }}
46
-
47
- - name: Build with Rails ${{ matrix.rails_version }}
48
- env:
49
- RAILS_VERSION: ${{ matrix.rails_version }}
50
- run: |
51
- bundle install --jobs 4 --retry 3
52
- bundle exec rake
53
-
54
- job_zeus:
55
- name: Zeus
56
- runs-on: ubuntu-latest
57
- steps:
58
- - uses: actions/checkout@v2
59
- - uses: actions/setup-node@v1
60
- - name: Set up Ruby
61
- uses: ruby/setup-ruby@v1
62
- with:
63
- ruby-version: 2.6 # Not needed with a .ruby-version file
64
- - run: bundle install
65
- - name: Install Zeus
66
- run: |
67
- yarn global add @zeus-ci/cli
68
- echo "::add-path::$(yarn global bin)"
69
- - name: Upload to Zeus
70
- env:
71
- ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }}
72
- ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }}
73
- run: |
74
- zeus job update -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -r $GITHUB_SHA
75
- gem build sentry-raven.gemspec
76
- zeus upload -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -t "application/tar+gem" ./*.gem
77
- zeus job update --status=passed -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -r $GITHUB_SHA
data/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- coverage
2
- pkg
3
- ruby/
4
- log/
5
- .bundle
6
- *.gem
7
- gemfiles/*.lock
8
- Gemfile.lock
9
- .coveralls.yml
10
- .ruby-version
11
- .ruby-gemset
12
- .idea
13
- *.rdb
14
-
15
- examples/**/node_modules
data/.gitmodules DELETED
File without changes
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --colour
data/.rubocop.yml DELETED
@@ -1,109 +0,0 @@
1
- AllCops:
2
- Include:
3
- - 'lib/**/*.rb'
4
- - 'spec/**/*.rb'
5
- Exclude:
6
- - 'examples/**/*'
7
- - 'vendor/**/*'
8
-
9
- Metrics/ClassLength:
10
- Max: 300
11
- CountComments: false
12
-
13
- Metrics/AbcSize:
14
- Max: 40
15
-
16
- Metrics/BlockLength:
17
- Enabled: false
18
-
19
- Metrics/CyclomaticComplexity:
20
- Max: 12
21
-
22
- Metrics/PerceivedComplexity:
23
- Max: 11
24
-
25
- Metrics/MethodLength:
26
- Max: 30
27
-
28
- Style/SymbolArray:
29
- Enabled: false
30
-
31
- Style/PercentLiteralDelimiters:
32
- Enabled: false
33
-
34
- Style/FrozenStringLiteralComment:
35
- Enabled: false
36
-
37
- Style/SignalException:
38
- Enabled: false
39
-
40
- Style/ClassAndModuleChildren:
41
- Enabled: false
42
-
43
- Style/RescueStandardError:
44
- Enabled: false
45
-
46
- Style/ParallelAssignment:
47
- Enabled: false
48
-
49
- Style/Documentation:
50
- Enabled: false
51
-
52
- Style/CommentedKeyword:
53
- Enabled: false
54
-
55
- Style/RescueModifier:
56
- Enabled: false
57
-
58
- Style/StringLiterals:
59
- Enabled: false
60
-
61
- Style/CaseEquality:
62
- Enabled: false
63
-
64
- Style/DoubleNegation:
65
- Enabled: false
66
-
67
- Style/GuardClause:
68
- Enabled: false
69
-
70
- Style/RedundantBegin:
71
- Enabled: false
72
-
73
- Style/NumericLiterals:
74
- Exclude:
75
- - 'spec/raven/processors/sanitizedata_processor_spec.rb'
76
-
77
- Style/HashSyntax:
78
- EnforcedStyle: hash_rockets
79
-
80
- Style/IfUnlessModifier:
81
- Enabled: false
82
-
83
- Lint/RescueException:
84
- Exclude:
85
- - 'lib/raven/base.rb'
86
- - 'lib/raven/instance.rb'
87
- - 'lib/raven/integrations/delayed_job.rb'
88
- - 'lib/raven/integrations/rack.rb'
89
- - 'lib/raven/integrations/sidekiq.rb'
90
- - 'spec/raven/event_spec.rb'
91
-
92
- Lint/SuppressedException:
93
- Enabled: false
94
-
95
- Lint/AssignmentInCondition:
96
- Enabled: false
97
-
98
- Layout/LineLength:
99
- Max: 155
100
-
101
- Naming/FileName:
102
- Exclude:
103
- - 'lib/sentry-raven-without-integrations.rb'
104
- - 'lib/sentry-raven.rb'
105
- - 'lib/raven/integrations/rack-timeout.rb'
106
-
107
- Naming/MethodParameterName:
108
- Enabled: false
109
-
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- file_names = ['lib/raven/version.rb']
4
-
5
- file_names.each do |file_name|
6
- text = File.read(file_name)
7
- new_contents = text.gsub(/\d.\d.\d/, ARGV[1])
8
- File.open(file_name, "w") {|file| file.puts new_contents }
9
- end