sentry-raven 3.0.4 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
  3. data/.github/pull_request_template.md +16 -0
  4. data/.github/workflows/test.yml +5 -0
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +6 -3
  7. data/CHANGELOG.md +134 -1
  8. data/CONTRIBUTING.md +71 -0
  9. data/README.md +8 -2
  10. data/lib/raven/backtrace.rb +2 -0
  11. data/lib/raven/base.rb +1 -0
  12. data/lib/raven/breadcrumbs/active_support_logger.rb +25 -0
  13. data/lib/raven/breadcrumbs/logger.rb +2 -92
  14. data/lib/raven/breadcrumbs/sentry_logger.rb +73 -0
  15. data/lib/raven/cli.rb +1 -1
  16. data/lib/raven/client.rb +1 -1
  17. data/lib/raven/configuration.rb +76 -4
  18. data/lib/raven/context.rb +13 -8
  19. data/lib/raven/event.rb +23 -13
  20. data/lib/raven/helpers/deprecation_helper.rb +17 -0
  21. data/lib/raven/instance.rb +8 -1
  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 +15 -2
  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/transports/http.rb +0 -2
  32. data/lib/raven/utils/context_filter.rb +42 -0
  33. data/lib/raven/version.rb +1 -1
  34. data/lib/sentry-raven-without-integrations.rb +6 -1
  35. data/lib/sentry_raven_without_integrations.rb +1 -0
  36. data/sentry-ruby/.gitignore +11 -0
  37. data/sentry-ruby/.rspec +3 -0
  38. data/sentry-ruby/.travis.yml +6 -0
  39. data/sentry-ruby/CODE_OF_CONDUCT.md +74 -0
  40. data/sentry-ruby/Gemfile +9 -0
  41. data/sentry-ruby/LICENSE.txt +21 -0
  42. data/sentry-ruby/README.md +44 -0
  43. data/sentry-ruby/Rakefile +6 -0
  44. data/sentry-ruby/bin/console +14 -0
  45. data/sentry-ruby/bin/setup +8 -0
  46. data/sentry-ruby/examples/rails-6.0/.browserslistrc +1 -0
  47. data/sentry-ruby/examples/rails-6.0/.gitignore +35 -0
  48. data/sentry-ruby/examples/rails-6.0/Gemfile +58 -0
  49. data/sentry-ruby/examples/rails-6.0/README.md +23 -0
  50. data/sentry-ruby/examples/rails-6.0/Rakefile +6 -0
  51. data/sentry-ruby/examples/rails-6.0/app/assets/config/manifest.js +2 -0
  52. data/sentry-ruby/examples/rails-6.0/app/assets/images/.keep +0 -0
  53. data/sentry-ruby/examples/rails-6.0/app/assets/stylesheets/application.css +15 -0
  54. data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/channel.rb +4 -0
  55. data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/connection.rb +4 -0
  56. data/sentry-ruby/examples/rails-6.0/app/controllers/application_controller.rb +2 -0
  57. data/sentry-ruby/examples/rails-6.0/app/controllers/concerns/.keep +0 -0
  58. data/sentry-ruby/examples/rails-6.0/app/controllers/welcome_controller.rb +23 -0
  59. data/sentry-ruby/examples/rails-6.0/app/helpers/application_helper.rb +2 -0
  60. data/sentry-ruby/examples/rails-6.0/app/javascript/channels/consumer.js +6 -0
  61. data/sentry-ruby/examples/rails-6.0/app/javascript/channels/index.js +5 -0
  62. data/sentry-ruby/examples/rails-6.0/app/javascript/packs/application.js +17 -0
  63. data/sentry-ruby/examples/rails-6.0/app/jobs/application_job.rb +7 -0
  64. data/sentry-ruby/examples/rails-6.0/app/mailers/application_mailer.rb +4 -0
  65. data/sentry-ruby/examples/rails-6.0/app/models/application_record.rb +3 -0
  66. data/sentry-ruby/examples/rails-6.0/app/models/concerns/.keep +0 -0
  67. data/sentry-ruby/examples/rails-6.0/app/views/layouts/application.html.erb +15 -0
  68. data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.html.erb +13 -0
  69. data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.text.erb +1 -0
  70. data/sentry-ruby/examples/rails-6.0/app/views/welcome/report_demo.html.erb +22 -0
  71. data/sentry-ruby/examples/rails-6.0/app/views/welcome/view_error.html.erb +1 -0
  72. data/sentry-ruby/examples/rails-6.0/app/workers/error_worker.rb +7 -0
  73. data/sentry-ruby/examples/rails-6.0/babel.config.js +72 -0
  74. data/sentry-ruby/examples/rails-6.0/bin/bundle +114 -0
  75. data/sentry-ruby/examples/rails-6.0/bin/rails +9 -0
  76. data/sentry-ruby/examples/rails-6.0/bin/rake +9 -0
  77. data/sentry-ruby/examples/rails-6.0/bin/setup +36 -0
  78. data/sentry-ruby/examples/rails-6.0/bin/spring +17 -0
  79. data/sentry-ruby/examples/rails-6.0/bin/webpack +18 -0
  80. data/sentry-ruby/examples/rails-6.0/bin/webpack-dev-server +18 -0
  81. data/sentry-ruby/examples/rails-6.0/bin/yarn +11 -0
  82. data/sentry-ruby/examples/rails-6.0/config.ru +5 -0
  83. data/sentry-ruby/examples/rails-6.0/config/application.rb +28 -0
  84. data/sentry-ruby/examples/rails-6.0/config/boot.rb +4 -0
  85. data/sentry-ruby/examples/rails-6.0/config/cable.yml +10 -0
  86. data/sentry-ruby/examples/rails-6.0/config/credentials.yml.enc +1 -0
  87. data/sentry-ruby/examples/rails-6.0/config/database.yml +25 -0
  88. data/sentry-ruby/examples/rails-6.0/config/environment.rb +5 -0
  89. data/sentry-ruby/examples/rails-6.0/config/environments/development.rb +62 -0
  90. data/sentry-ruby/examples/rails-6.0/config/environments/production.rb +112 -0
  91. data/sentry-ruby/examples/rails-6.0/config/environments/test.rb +48 -0
  92. data/sentry-ruby/examples/rails-6.0/config/initializers/application_controller_renderer.rb +8 -0
  93. data/sentry-ruby/examples/rails-6.0/config/initializers/assets.rb +14 -0
  94. data/sentry-ruby/examples/rails-6.0/config/initializers/backtrace_silencers.rb +7 -0
  95. data/sentry-ruby/examples/rails-6.0/config/initializers/content_security_policy.rb +30 -0
  96. data/sentry-ruby/examples/rails-6.0/config/initializers/cookies_serializer.rb +5 -0
  97. data/sentry-ruby/examples/rails-6.0/config/initializers/filter_parameter_logging.rb +4 -0
  98. data/sentry-ruby/examples/rails-6.0/config/initializers/inflections.rb +16 -0
  99. data/sentry-ruby/examples/rails-6.0/config/initializers/mime_types.rb +4 -0
  100. data/sentry-ruby/examples/rails-6.0/config/initializers/wrap_parameters.rb +14 -0
  101. data/sentry-ruby/examples/rails-6.0/config/locales/en.yml +33 -0
  102. data/sentry-ruby/examples/rails-6.0/config/puma.rb +38 -0
  103. data/sentry-ruby/examples/rails-6.0/config/routes.rb +10 -0
  104. data/sentry-ruby/examples/rails-6.0/config/spring.rb +6 -0
  105. data/sentry-ruby/examples/rails-6.0/config/storage.yml +34 -0
  106. data/sentry-ruby/examples/rails-6.0/config/webpack/development.js +5 -0
  107. data/sentry-ruby/examples/rails-6.0/config/webpack/environment.js +3 -0
  108. data/sentry-ruby/examples/rails-6.0/config/webpack/production.js +5 -0
  109. data/sentry-ruby/examples/rails-6.0/config/webpack/test.js +5 -0
  110. data/sentry-ruby/examples/rails-6.0/config/webpacker.yml +96 -0
  111. data/sentry-ruby/examples/rails-6.0/db/seeds.rb +7 -0
  112. data/sentry-ruby/examples/rails-6.0/lib/assets/.keep +0 -0
  113. data/sentry-ruby/examples/rails-6.0/lib/tasks/.keep +0 -0
  114. data/sentry-ruby/examples/rails-6.0/package.json +15 -0
  115. data/sentry-ruby/examples/rails-6.0/postcss.config.js +12 -0
  116. data/sentry-ruby/examples/rails-6.0/public/404.html +67 -0
  117. data/sentry-ruby/examples/rails-6.0/public/422.html +67 -0
  118. data/sentry-ruby/examples/rails-6.0/public/500.html +66 -0
  119. data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon-precomposed.png +0 -0
  120. data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon.png +0 -0
  121. data/sentry-ruby/examples/rails-6.0/public/favicon.ico +0 -0
  122. data/sentry-ruby/examples/rails-6.0/public/robots.txt +1 -0
  123. data/sentry-ruby/examples/rails-6.0/storage/.keep +0 -0
  124. data/sentry-ruby/examples/rails-6.0/test/application_system_test_case.rb +5 -0
  125. data/sentry-ruby/examples/rails-6.0/test/channels/application_cable/connection_test.rb +11 -0
  126. data/sentry-ruby/examples/rails-6.0/test/controllers/.keep +0 -0
  127. data/sentry-ruby/examples/rails-6.0/test/fixtures/.keep +0 -0
  128. data/sentry-ruby/examples/rails-6.0/test/fixtures/files/.keep +0 -0
  129. data/sentry-ruby/examples/rails-6.0/test/helpers/.keep +0 -0
  130. data/sentry-ruby/examples/rails-6.0/test/integration/.keep +0 -0
  131. data/sentry-ruby/examples/rails-6.0/test/mailers/.keep +0 -0
  132. data/sentry-ruby/examples/rails-6.0/test/models/.keep +0 -0
  133. data/sentry-ruby/examples/rails-6.0/test/system/.keep +0 -0
  134. data/sentry-ruby/examples/rails-6.0/test/test_helper.rb +13 -0
  135. data/sentry-ruby/examples/rails-6.0/vendor/.keep +0 -0
  136. data/sentry-ruby/examples/rails-6.0/yarn.lock +7508 -0
  137. data/sentry-ruby/lib/sentry.rb +16 -0
  138. data/sentry-ruby/lib/sentry/backtrace.rb +128 -0
  139. data/sentry-ruby/lib/sentry/client.rb +162 -0
  140. data/sentry-ruby/lib/sentry/client/state.rb +40 -0
  141. data/sentry-ruby/lib/sentry/configuration.rb +533 -0
  142. data/sentry-ruby/lib/sentry/event.rb +209 -0
  143. data/sentry-ruby/lib/sentry/interface.rb +31 -0
  144. data/sentry-ruby/lib/sentry/interfaces/exception.rb +15 -0
  145. data/sentry-ruby/lib/sentry/interfaces/http.rb +16 -0
  146. data/sentry-ruby/lib/sentry/interfaces/message.rb +18 -0
  147. data/sentry-ruby/lib/sentry/interfaces/single_exception.rb +14 -0
  148. data/sentry-ruby/lib/sentry/interfaces/stack_trace.rb +69 -0
  149. data/sentry-ruby/lib/sentry/linecache.rb +44 -0
  150. data/sentry-ruby/lib/sentry/logger.rb +20 -0
  151. data/sentry-ruby/lib/sentry/transports.rb +19 -0
  152. data/sentry-ruby/lib/sentry/transports/dummy.rb +16 -0
  153. data/sentry-ruby/lib/sentry/transports/http.rb +66 -0
  154. data/sentry-ruby/lib/sentry/transports/stdout.rb +20 -0
  155. data/sentry-ruby/lib/sentry/utils/deep_merge.rb +22 -0
  156. data/sentry-ruby/lib/sentry/utils/exception_cause_chain.rb +20 -0
  157. data/sentry-ruby/lib/sentry/version.rb +3 -0
  158. data/sentry-ruby/sentry-ruby.gemspec +26 -0
  159. data/sentry-ruby/spec/sentry/backtrace_spec.rb +38 -0
  160. data/sentry-ruby/spec/sentry/client_spec.rb +443 -0
  161. data/sentry-ruby/spec/sentry/configuration_spec.rb +400 -0
  162. data/sentry-ruby/spec/sentry/event_spec.rb +238 -0
  163. data/sentry-ruby/spec/sentry/interface_spec.rb +38 -0
  164. data/sentry-ruby/spec/sentry/interfaces/stack_trace_spec.rb +11 -0
  165. data/sentry-ruby/spec/sentry/linecache_spec.rb +40 -0
  166. data/sentry-ruby/spec/sentry/transports/http_spec.rb +57 -0
  167. data/sentry-ruby/spec/sentry/transports/stdout_spec.rb +11 -0
  168. data/sentry-ruby/spec/sentry_spec.rb +9 -0
  169. data/sentry-ruby/spec/spec_helper.rb +49 -0
  170. data/sentry-ruby/spec/support/linecache.txt +6 -0
  171. metadata +148 -4
  172. data/CONTRIUTING.md +0 -26
  173. data/lib/raven/breadcrumbs/activesupport.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0e19bd3b705bd0a2c680d367ea7420941d5df1c5b245317170b9c31fd177006
4
- data.tar.gz: f826cbfb501dfd844ff1096b8561ffc8a2e4f589d51d186ce063e4cfcabc65aa
3
+ metadata.gz: 9409fd1db13a8eec36f00e801c3391b84739dc6166123e5397494b85766149ec
4
+ data.tar.gz: 3a9eb01cfdf1922ec4e8b1a5553a31d224a7df39fc6a37ddbed9277e4b3d72ab
5
5
  SHA512:
6
- metadata.gz: 8f47ca78fad6ebc47e9a76efd32e8009e6b8196256b06edef38dc1081a4eafb57f0f880e69d3e423ef5dffe6f66f2651c6c1fa2ca4002ad1c5be352b541bdfb3
7
- data.tar.gz: f6e95e7a313ece5ebfb1af584d2cd11648575a6121a0ff0b807180e396bfb8102b1bc0cc1914d96e26058273193dbf6014c0acd6ded8dbef284cac6d0279ab79
6
+ metadata.gz: 46c863f1960b12c97a03a91edda72dd4ec16d04da2e6890a80bd736b092b11e44e74822c6497219883f7ed1c5c135e7b789b36da299fcba389f2accdefb83b97
7
+ data.tar.gz: 560dad6f93a0fbd345100b4c4de7e578dedb874a8fab63a8168f629b53d13938276cf4f10db6e2dd357ffc8fa04dc91a87dac6185bcd7e5e3585bbf98ef09e5c
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: bug
6
+ assignees: st0012
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+
12
+ **To Reproduce**
13
+
14
+ **Expected behavior**
15
+
16
+ **Actual behavior**
17
+
18
+ **Environment**
19
+ - Ruby Version:
20
+ - SDK Version:
21
+ - Integration Versions (if any):
22
+ - e.g. Rails 6.0, Sidekiq 6.1.2
23
+
24
+ **Raven Config**
25
+
26
+ This is not necessary but could be helpful.
27
+
28
+ ```ruby
29
+ Raven.configure do |config|
30
+ # the config you're using, without DSN and other sensitive data
31
+ end
32
+ ```
@@ -0,0 +1,16 @@
1
+ Thanks for your Pull Request 🎉
2
+
3
+ **Please keep these instructions in mind so we can review it more efficiently:**
4
+
5
+ - Add the references of all the related issues/PRs in the description
6
+ - Whether it's a new feature or a bug fix, make sure they're covered by new test cases
7
+ - If this PR contains any refactoring work, please give it its own commit(s)
8
+
9
+
10
+ **Other Notes**
11
+ - We squash all commits before merging
12
+ - We generally review new PRs within a week
13
+ - If you have any question, you can ask for feedback in our [discord community](https://discord.gg/Ww9hbqr) first
14
+
15
+ ## Description
16
+ Describe your changes:
@@ -43,6 +43,11 @@ jobs:
43
43
  bundler: 1
44
44
  ruby-version: ${{ matrix.ruby_version }}
45
45
 
46
+ - name: Start Redis
47
+ uses: supercharge/redis-github-action@1.1.0
48
+ with:
49
+ redis-version: 5
50
+
46
51
  - name: Build with Rails ${{ matrix.rails_version }}
47
52
  env:
48
53
  RAILS_VERSION: ${{ matrix.rails_version }}
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  coverage
2
2
  pkg
3
+ tmp
3
4
  ruby/
4
5
  log/
5
6
  .bundle
@@ -7,7 +7,7 @@ AllCops:
7
7
  - 'vendor/**/*'
8
8
 
9
9
  Metrics/ClassLength:
10
- Max: 300
10
+ Max: 350
11
11
  CountComments: false
12
12
 
13
13
  Metrics/AbcSize:
@@ -23,7 +23,7 @@ Metrics/PerceivedComplexity:
23
23
  Max: 11
24
24
 
25
25
  Metrics/MethodLength:
26
- Max: 30
26
+ Max: 40
27
27
 
28
28
  Style/SymbolArray:
29
29
  Enabled: false
@@ -55,6 +55,9 @@ Style/CommentedKeyword:
55
55
  Style/RescueModifier:
56
56
  Enabled: false
57
57
 
58
+ Style/RegexpLiteral:
59
+ Enabled: false
60
+
58
61
  Style/StringLiterals:
59
62
  Enabled: false
60
63
 
@@ -75,7 +78,7 @@ Style/NumericLiterals:
75
78
  - 'spec/raven/processors/sanitizedata_processor_spec.rb'
76
79
 
77
80
  Style/HashSyntax:
78
- EnforcedStyle: hash_rockets
81
+ Enabled: false
79
82
 
80
83
  Style/IfUnlessModifier:
81
84
  Enabled: false
@@ -1,6 +1,139 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 3.1.1
4
+
5
+ **Feature**
6
+
7
+ - Add request id to headers if exists ([#1033](https://github.com/getsentry/sentry-ruby/pull/1033))
8
+
9
+ - Allow blocks on user_context ([#1023](https://github.com/getsentry/sentry-ruby/pull/1023))
10
+
11
+ - Enable configurable rack environment recorded parameters ([#860](https://github.com/getsentry/sentry-ruby/pull/860))
12
+
13
+ - Remove ActiveJob keys for both Sidekiq and DelayedJob ([#898](https://github.com/getsentry/sentry-ruby/pull/898))
14
+
15
+ **Fix**
16
+
17
+ - Remove circular dependency in transport/http.rb ([#1035](https://github.com/getsentry/sentry-ruby/pull/1035))
18
+
19
+ ## 3.1.0
20
+
21
+ **Feature**
22
+
23
+ - Exclude all 4xx Rails errors ([#1004](https://github.com/getsentry/raven-ruby/pull/1004))
24
+
25
+ See the full list [here](https://github.com/getsentry/raven-ruby/blob/master/lib/raven/configuration.rb#L198-L219)
26
+
27
+ - Add some error context in `transport_failure_callback` ([#1003](https://github.com/getsentry/raven-ruby/pull/1003))
28
+
29
+ Before:
30
+
31
+ ```ruby
32
+ config.transport_failure_callback = lambda { |event|
33
+ AdminMailer.email_admins("Oh god, it's on fire!", event).deliver_later
34
+ }
35
+ ```
36
+
37
+ After:
38
+
39
+ ```ruby
40
+ config.transport_failure_callback = lambda { |event, error|
41
+ AdminMailer.email_admins("Oh god, it's on fire because #{error.message}!", event).deliver_later
42
+ }
43
+ ```
44
+
45
+ - Support cleaning up exception backtrace with customized backtrace_cleaner ([#1011](https://github.com/getsentry/raven-ruby/pull/1011))
46
+
47
+ The new config `backtrace_cleanup_callback` takes a lambda/proc object (default is `nil`) and will be called with exception's backtrace
48
+
49
+ ```ruby
50
+ Raven.configure do |config|
51
+ config.backtrace_cleanup_callback = lambda do |backtrace|
52
+ Rails.backtrace_cleaner.clean(backtrace)
53
+ end
54
+ end
55
+ ```
56
+
57
+ And with the Rails integration, it'll automatically use a customized `Raven::Rails::BacktraceCleaner` to clean up exception's backtrace. It's basically Rails 6's [backtrace cleaner](https://github.com/rails/rails/blob/master/railties/lib/rails/backtrace_cleaner.rb) but without silencers.
58
+
59
+ The main reason to add this cleaner is to remove template methods from the trace, e.g.
60
+
61
+ ```
62
+ app/views/welcome/view_error.html.erb in _app_views_welcome_view_error_html_erb__2807287320172182514_65600 at line 1
63
+ ```
64
+
65
+ will become
66
+
67
+ ```
68
+ app/views/welcome/view_error.html.erb at line 1
69
+ ```
70
+
71
+ This can help Sentry group issues more accurately. See [#957](https://github.com/getsentry/raven-ruby/issues/957) for more information about this.
72
+
73
+ If you don't want this change, you can disable it with:
74
+
75
+ ```ruby
76
+ Raven.configure do |config|
77
+ config.backtrace_cleanup_callback = nil
78
+ end
79
+ ```
80
+
81
+
82
+ - Make dsn value accessable from config ([#1012](https://github.com/getsentry/raven-ruby/pull/1012))
83
+
84
+ You can now access the dsn value via `Raven.configuration.dsn`
85
+
86
+ **Deprecation**
87
+
88
+ - Deprecate dasherized filenames ([#1006](https://github.com/getsentry/raven-ruby/pull/1006))
89
+
90
+ If you're using
91
+
92
+ ```ruby
93
+ gem 'sentry-raven', require: 'sentry-raven-without-integrations'
94
+ # or
95
+ require "sentry-raven-without-integrations"
96
+ ```
97
+
98
+ you will start seeing deprecation warnings. Please change them into
99
+
100
+ ```ruby
101
+ gem 'sentry-raven', require: 'sentry_raven_without_integrations'
102
+ # or
103
+ require "sentry_raven_without_integrations"
104
+ ```
105
+
106
+ - Unify breadcrumb loggers activation ([#1016](https://github.com/getsentry/raven-ruby/pull/1016))
107
+
108
+ Currently, we activate our breadcrumb loggers differently:
109
+
110
+ ```ruby
111
+ require "raven/breadcrumbs/sentry_logger"
112
+ Raven.configuration.rails_activesupport_breadcrumbs = true
113
+ ```
114
+
115
+ It's not a nice user interface, so this PR adds a new configuration
116
+ option `breadcrumbs_logger` to improve this:
117
+
118
+ ```ruby
119
+ Raven.configuration.breadcrumbs_logger = :sentry_logger
120
+ Raven.configuration.breadcrumbs_logger = :active_support_logger
121
+ Raven.configuration.breadcrumbs_logger = [:sentry_logger, :active_support_logger]
122
+ ```
123
+
124
+ Please migrate to the new activation apporach, otherwise you'll see depraction warnings. And old ones will be dropped in version 4.0.
125
+
126
+ **Refactor**
127
+
128
+ - Accept non-string message in Event.from_exception ([#1005](https://github.com/getsentry/raven-ruby/pull/1005))
129
+ - Refactor event initialization ([#1010](https://github.com/getsentry/raven-ruby/pull/1010))
130
+ - Refactor sidekiq integration ([#1019](https://github.com/getsentry/raven-ruby/pull/1019))
131
+
132
+ **Fix**
133
+
134
+ - Replace sys_command usages in context.rb ([#1017](https://github.com/getsentry/raven-ruby/pull/1017))
135
+ - Fix merge error from rack-timeout raven_context on old releases ([#1007](https://github.com/getsentry/raven-ruby/pull/1007))
136
+ - Return value of `rescue_with_handler` when intercepting ActiveJob exceptions ([#1027](https://github.com/getsentry/raven-ruby/pull/1027))
4
137
 
5
138
  ## 3.0.4
6
139
 
@@ -0,0 +1,71 @@
1
+ <p align="center">
2
+ <a href="https://sentry.io" target="_blank" align="center">
3
+ <img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
4
+ </a>
5
+ <br />
6
+ </p>
7
+
8
+ # Contributing
9
+
10
+ You can contribute this project in the following ways:
11
+
12
+ - File a [bug report] or propose a feature
13
+ - Open a PR for bug fixes or implementing requested features
14
+ - Give feedback to opened issues/pull requests
15
+ - Test the latest version - `gem 'sentry-raven', github: 'getsentry/raven-ruby'`
16
+ - Contribute documentation in the [document repo]
17
+
18
+
19
+ And if you have any questions, please feel free to reach out on [Discord].
20
+
21
+
22
+ [bug report]: https://github.com/getsentry/raven-ruby/issues/new?template=bug_report.md
23
+ [document repo]: https://github.com/getsentry/sentry-docs
24
+ [Discord]: https://discord.gg/Ww9hbqr
25
+
26
+ ## How To Contribute
27
+
28
+ ### Running Tests
29
+
30
+ #### RAILS_VERSION
31
+
32
+ Because this SDK supports multiple versions of Rails, or even without Rails, you might want to run your test against different versions of Rails.
33
+
34
+ You can do this by changing the `RAILS_VERSION` environment variable:
35
+
36
+
37
+ ```
38
+ $ echo RAILS_VERSION=6.0
39
+ $ bundle update # this is necessary if you're switching between Rails versions
40
+ $ bundle exec rake
41
+ ```
42
+
43
+ If not specified, it runs tests against `Rails 5.2`.
44
+
45
+ And if you don't want to run the Rails related test cases, you can use `RAILS_VERSION=0`
46
+
47
+ ```
48
+ $ RAILS_VERSION=0 bundle exec rake # runs without Rails related test cases
49
+ ```
50
+
51
+ ### Testing Your Change Against Example Rails Apps
52
+
53
+ We have a few example apps for different Rails versions under the `/examples` folder. You can use them to perform an end-to-end testing on your changes (just remember to change the DSN to your project's).
54
+
55
+ At this moment, we recommend testing against the [Rails 6 example](https://github.com/getsentry/raven-ruby/tree/master/examples/rails-6.0) first. Please read its readme to see what kind of testing you can perform with it.
56
+
57
+
58
+ ## Making a release
59
+
60
+ Install and use `craft`: https://github.com/getsentry/craft
61
+
62
+ Make sure the `CHANGELOG.md` is update and latest `master` contains all changes.
63
+
64
+ Run:
65
+
66
+ ```bash
67
+ craft prepare x.x.x
68
+ ```
69
+
70
+ Where `x.x.x` stands for the version you want to release.
71
+ Afterwards reach out to an employee of Sentry, they will cut a release by running the `publish` process of `craft`.
data/README.md CHANGED
@@ -7,6 +7,11 @@
7
7
 
8
8
  # Raven-Ruby, the Ruby Client for Sentry
9
9
 
10
+ ### 🚧 We're restructuring this SDK for the [version 4.0](https://github.com/getsentry/raven-ruby/issues/1029) 🚧
11
+
12
+ ---
13
+
14
+
10
15
  [![Gem Version](https://img.shields.io/gem/v/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven)
11
16
  ![Build Status](https://github.com/getsentry/raven-ruby/workflows/Test/badge.svg)
12
17
  [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/raven-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/raven-ruby/branch/master)
@@ -18,6 +23,7 @@
18
23
 
19
24
  The official Ruby-language client and integration layer for the [Sentry](https://github.com/getsentry/sentry) error reporting API.
20
25
 
26
+
21
27
  ## Requirements
22
28
 
23
29
  We test on Ruby 2.3, 2.4, 2.5, 2.6 and 2.7 at the latest patchlevel/teeny version. We also support JRuby 9.0. Our Rails integration works with Rails 4.2+, including Rails 5 and Rails 6.
@@ -105,8 +111,8 @@ end
105
111
  If Raven fails to send an event to Sentry for any reason (either the Sentry server has returned a 4XX or 5XX response), this Proc or lambda will be called.
106
112
 
107
113
  ```ruby
108
- config.transport_failure_callback = lambda { |event|
109
- AdminMailer.email_admins("Oh god, it's on fire!", event).deliver_later
114
+ config.transport_failure_callback = lambda { |event, error|
115
+ AdminMailer.email_admins("Oh god, it's on fire because #{error.message}!", event).deliver_later
110
116
  }
111
117
  ```
112
118
 
@@ -94,6 +94,8 @@ module Raven
94
94
  def self.parse(backtrace, opts = {})
95
95
  ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/)
96
96
 
97
+ ruby_lines = opts[:configuration].backtrace_cleanup_callback.call(ruby_lines) if opts[:configuration]&.backtrace_cleanup_callback
98
+
97
99
  filters = opts[:filters] || []
98
100
  filtered_lines = ruby_lines.to_a.map do |line|
99
101
  filters.reduce(line) do |nested_line, proc|
@@ -1,4 +1,5 @@
1
1
  require 'raven/version'
2
+ require "raven/helpers/deprecation_helper"
2
3
  require 'raven/core_ext/object/deep_dup'
3
4
  require 'raven/backtrace'
4
5
  require 'raven/breadcrumbs'
@@ -0,0 +1,25 @@
1
+ module Raven
2
+ module Breadcrumbs
3
+ module ActiveSupportLogger
4
+ class << self
5
+ def add(name, started, _finished, _unique_id, data)
6
+ Raven.breadcrumbs.record do |crumb|
7
+ crumb.data = data
8
+ crumb.category = name
9
+ crumb.timestamp = started.to_i
10
+ end
11
+ end
12
+
13
+ def inject
14
+ @subscriber = ::ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
15
+ add(name, started, finished, unique_id, data)
16
+ end
17
+ end
18
+
19
+ def detach
20
+ ::ActiveSupport::Notifications.unsubscribe(@subscriber)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,93 +1,3 @@
1
- require 'logger'
1
+ DeprecationHelper.deprecate_old_breadcrumbs_configuration(:sentry_logger)
2
2
 
3
- module Raven
4
- module BreadcrumbLogger
5
- LEVELS = {
6
- ::Logger::DEBUG => 'debug',
7
- ::Logger::INFO => 'info',
8
- ::Logger::WARN => 'warn',
9
- ::Logger::ERROR => 'error',
10
- ::Logger::FATAL => 'fatal'
11
- }.freeze
12
-
13
- EXC_FORMAT = /^([a-zA-Z0-9]+)\:\s(.*)$/.freeze
14
-
15
- def self.parse_exception(message)
16
- lines = message.split(/\n\s*/)
17
- # TODO: wat
18
- return nil unless lines.length > 2
19
-
20
- match = lines[0].match(EXC_FORMAT)
21
- return nil unless match
22
-
23
- _, type, value = match.to_a
24
- [type, value]
25
- end
26
-
27
- def add(*args)
28
- add_breadcrumb(*args)
29
- super
30
- end
31
-
32
- def add_breadcrumb(severity, message = nil, progname = nil)
33
- message = progname if message.nil? # see Ruby's Logger docs for why
34
- return if ignored_logger?(progname)
35
- return if message.nil? || message == ""
36
-
37
- # some loggers will add leading/trailing space as they (incorrectly, mind you)
38
- # think of logging as a shortcut to std{out,err}
39
- message = message.to_s.strip
40
-
41
- last_crumb = Raven.breadcrumbs.peek
42
- # try to avoid dupes from logger broadcasts
43
- if last_crumb.nil? || last_crumb.message != message
44
- error = Raven::BreadcrumbLogger.parse_exception(message)
45
- # TODO(dcramer): we need to filter out the "currently captured error"
46
- if error
47
- Raven.breadcrumbs.record do |crumb|
48
- crumb.level = Raven::BreadcrumbLogger::LEVELS.fetch(severity, nil)
49
- crumb.category = progname || 'error'
50
- crumb.type = 'error'
51
- crumb.data = {
52
- :type => error[0],
53
- :value => error[1]
54
- }
55
- end
56
- else
57
- Raven.breadcrumbs.record do |crumb|
58
- crumb.level = Raven::BreadcrumbLogger::LEVELS.fetch(severity, nil)
59
- crumb.category = progname || 'logger'
60
- crumb.message = message
61
- end
62
- end
63
- end
64
- end
65
-
66
- private
67
-
68
- def ignored_logger?(progname)
69
- progname == "sentry" ||
70
- Raven.configuration.exclude_loggers.include?(progname)
71
- end
72
- end
73
- module OldBreadcrumbLogger
74
- def self.included(base)
75
- base.class_eval do
76
- include Raven::BreadcrumbLogger
77
- alias_method :add_without_raven, :add
78
- alias_method :add, :add_with_raven
79
- end
80
- end
81
-
82
- def add_with_raven(*args)
83
- add_breadcrumb(*args)
84
- add_without_raven(*args)
85
- end
86
- end
87
- end
88
-
89
- Raven.safely_prepend(
90
- "BreadcrumbLogger",
91
- :from => Raven,
92
- :to => ::Logger
93
- )
3
+ require "raven/breadcrumbs/sentry_logger"