sentry-raven 2.7.4 → 2.8.0

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
  SHA1:
3
- metadata.gz: 39f754caa8c8dc1d3adf0a5ef6fc1691817c4902
4
- data.tar.gz: 1367510ab3abaed41237210d7810626d7bf87fb5
3
+ metadata.gz: b2c9069a9b5cfae47df6590266f31063b07347f4
4
+ data.tar.gz: bacb13812cd83d2e16befab52f47c3cd08f481ec
5
5
  SHA512:
6
- metadata.gz: 2deb6a18853cd32279e3a4c02a202cf661cb45062700d1efff75284ae7f31955426f774f91d461b9e4e74f13847fb092bf09957abab57cb79a2817e4949be3a3
7
- data.tar.gz: 9cc99e456d2485bcd80e92f3d7b4c9f40429d96872d904dcec006804ee4e31b20325366ba263f14872b8b96b4a8e9aaa1f7c1fc53485b96e0a952c9955d28e3e
6
+ metadata.gz: 94aa454b77018b446f06d1daf50bc97679fc76d45362bf63e1e876fad72882a3363dfe83d0a68b03b04b1e4590b55578e451e42d2badb538b44322ef5b794a06
7
+ data.tar.gz: e5a2752c30d82bbeeaece755f09a4f4660b58aee9172460968447f40958a6c3ff0fc02b267040c1476097b361a0bc2785b61220acfaff1351e8dff4202010bb3
data/.gitignore CHANGED
@@ -2,7 +2,6 @@ coverage
2
2
  pkg
3
3
  ruby/
4
4
  log/
5
- docs/_build
6
5
  .bundle
7
6
  *.gem
8
7
  gemfiles/*.lock
@@ -1,3 +0,0 @@
1
- [submodule "docs/_sentryext"]
2
- path = docs/_sentryext
3
- url = https://github.com/getsentry/sentry-doc-support
@@ -7,7 +7,7 @@ AllCops:
7
7
  - 'vendor/**/*'
8
8
 
9
9
  Metrics/ClassLength:
10
- Max: 269
10
+ Max: 300
11
11
  CountComments: false
12
12
 
13
13
  Metrics/AbcSize:
@@ -37,9 +37,9 @@ matrix:
37
37
  env: RAILS_VERSION=4
38
38
  - rvm: jruby-1.7.27
39
39
  env: JRUBY_OPTS="--dev" RAILS_VERSION=4
40
- - rvm: jruby-9.1.17.0
40
+ - rvm: jruby-9.2.0.0
41
41
  env: JRUBY_OPTS="--dev -J-Djruby.launch.inproc=true -J-Xmx1024M" RAILS_VERSION=4
42
- - rvm: jruby-9.1.17.0
42
+ - rvm: jruby-9.2.0.0
43
43
  env: JRUBY_OPTS="--dev -J-Djruby.launch.inproc=true -J-Xmx1024M" RAILS_VERSION=5
44
44
  - rvm: ruby-head
45
45
  env: RAILS_VERSION=0
data/Gemfile CHANGED
@@ -4,12 +4,12 @@ gemspec
4
4
 
5
5
  if ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 4)
6
6
  gem "rails", "< 5"
7
- gem "rspec-rails"
7
+ gem "rspec-rails", "> 3"
8
8
  elsif ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 0)
9
9
  # no-op. No Rails.
10
10
  else
11
11
  gem "rails", "< 6"
12
- gem "rspec-rails"
12
+ gem "rspec-rails", "> 3"
13
13
  end
14
14
 
15
15
  if RUBY_VERSION < '2.0'
@@ -28,9 +28,9 @@ gem "pry-coolline"
28
28
  gem "benchmark-ips"
29
29
  gem "benchmark-ipsa" if RUBY_VERSION > '2.0'
30
30
  gem "ruby-prof", platform: :mri
31
- gem "rake"
32
- gem "rubocop", "~> 0.41.1"
33
- gem "rspec"
31
+ gem "rake", "> 12"
32
+ gem "rubocop", "~> 0.41.1" # Last version that supported 1.9, upgrade to 0.50 after we drop 1.9
33
+ gem "rspec", "> 3"
34
34
  gem "capybara" # rspec system tests
35
35
  gem "puma" # rspec system tests
36
36
 
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  <p align="center">
2
- <img src="https://cdn.rawgit.com/getsentry/raven-python/1e525422/docs/_static/logo.png">
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>
3
6
  </p>
4
7
 
5
8
  # Raven-Ruby, the Ruby Client for Sentry
@@ -7,6 +10,7 @@
7
10
  [![Gem Version](https://img.shields.io/gem/v/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven)
8
11
  [![Build Status](https://img.shields.io/travis/getsentry/raven-ruby/master.svg)](https://travis-ci.org/getsentry/raven-ruby)
9
12
  [![Gem](https://img.shields.io/gem/dt/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven/)
13
+ [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)
10
14
 
11
15
 
12
16
  [Documentation](https://docs.getsentry.com/hosted/clients/ruby/) | [Bug Tracker](https://github.com/getsentry/raven-ruby/issues) | [Forum](https://forum.sentry.io/) | IRC: irc.freenode.net, #sentry
@@ -31,12 +35,12 @@ Raven will capture and send exceptions to the Sentry server whenever its DSN is
31
35
 
32
36
  ```bash
33
37
  # Set your SENTRY_DSN environment variable.
34
- export SENTRY_DSN=http://public:secret@example.com/project-id
38
+ export SENTRY_DSN=http://public@example.com/project-id
35
39
  ```
36
40
  ```ruby
37
41
  # Or you can configure the client in the code (not recommended - keep your DSN secret!)
38
42
  Raven.configure do |config|
39
- config.dsn = 'http://public:secret@example.com/project-id'
43
+ config.dsn = 'http://public@example.com/project-id'
40
44
  end
41
45
  ```
42
46
 
@@ -126,7 +130,7 @@ For more information, see [Context](https://docs.sentry.io/clients/ruby/context/
126
130
 
127
131
  ## More Information
128
132
 
129
- * [Documentation](https://docs.getsentry.com/hosted/clients/ruby/)
133
+ * [Documentation](https://docs.sentry.io/clients/ruby/)
130
134
  * [Bug Tracker](https://github.com/getsentry/raven-ruby/issues)
131
135
  * [Forum](https://forum.sentry.io/)
132
136
  * [IRC](irc://irc.freenode.net/sentry>) (irc.freenode.net, #sentry)
@@ -1,3 +1,8 @@
1
+ 2.8.0
2
+ -----
3
+
4
+ * FEATURE: Added `config.before_send`. Provide a lambda or proc to this config setting, which will be `call`ed when before sending an event to Sentry. Receives `event` and `hint` as parameter. `hint` is a has {:exception => ex | nil, :message => message | nil}. [@hazat, #847]
5
+
1
6
  2.7.4
2
7
  -----
3
8
 
@@ -18,9 +18,15 @@ module Raven
18
18
  @state = ClientState.new
19
19
  end
20
20
 
21
- def send_event(event)
21
+ def send_event(event, hint = nil)
22
22
  return false unless configuration.sending_allowed?(event)
23
23
 
24
+ event = configuration.before_send.call(event, hint) if configuration.before_send
25
+ if event.nil?
26
+ configuration.logger.info "Discarded event because before_send returned nil"
27
+ return
28
+ end
29
+
24
30
  # Convert to hash
25
31
  event = event.to_hash
26
32
 
@@ -50,6 +56,8 @@ module Raven
50
56
  case configuration.scheme
51
57
  when 'http', 'https'
52
58
  Transports::HTTP.new(configuration)
59
+ when 'stdout'
60
+ Transports::Stdout.new(configuration)
53
61
  when 'dummy'
54
62
  Transports::Dummy.new(configuration)
55
63
  else
@@ -156,6 +156,15 @@ module Raven
156
156
  # E.g. lambda { |event| Thread.new { MyJobProcessor.send_email(event) } }
157
157
  attr_reader :transport_failure_callback
158
158
 
159
+ # Optional Proc, called before sending an event to the server/
160
+ # E.g.: lambda { |event, hint| event }
161
+ # E.g.: lambda { |event, hint| nil }
162
+ # E.g.: lambda { |event, hint|
163
+ # event[:message] = 'a'
164
+ # event
165
+ # }
166
+ attr_reader :before_send
167
+
159
168
  # Errors object - an Array that contains error messages. See #
160
169
  attr_reader :errors
161
170
 
@@ -182,6 +191,9 @@ module Raven
182
191
  Raven::Processor::HTTPHeaders
183
192
  ].freeze
184
193
 
194
+ HEROKU_DYNO_METADATA_MESSAGE = "You are running on Heroku but haven't enabled Dyno Metadata. For Sentry's "\
195
+ "release detection to work correctly, please run `heroku labs:enable runtime-dyno-metadata`".freeze
196
+
185
197
  LOG_PREFIX = "** [Raven] ".freeze
186
198
  MODULE_SEPARATOR = "::".freeze
187
199
 
@@ -214,6 +226,7 @@ module Raven
214
226
  self.tags = {}
215
227
  self.timeout = 2
216
228
  self.transport_failure_callback = false
229
+ self.before_send = false
217
230
  end
218
231
 
219
232
  def server=(value)
@@ -266,6 +279,13 @@ module Raven
266
279
  @should_capture = value
267
280
  end
268
281
 
282
+ def before_send=(value)
283
+ unless value == false || value.respond_to?(:call)
284
+ raise ArgumentError, "before_send must be callable (or false to disable)"
285
+ end
286
+ @before_send = value
287
+ end
288
+
269
289
  # Allows config options to be read like a hash
270
290
  #
271
291
  # @param [Symbol] option Key for a given attribute
@@ -352,7 +372,7 @@ module Raven
352
372
  def detect_release_from_heroku
353
373
  return unless running_on_heroku?
354
374
  return if ENV['CI']
355
- logger.warn(heroku_dyno_metadata_message) && return unless ENV['HEROKU_SLUG_COMMIT']
375
+ logger.warn(HEROKU_DYNO_METADATA_MESSAGE) && return unless ENV['HEROKU_SLUG_COMMIT']
356
376
 
357
377
  ENV['HEROKU_SLUG_COMMIT']
358
378
  end
@@ -361,11 +381,6 @@ module Raven
361
381
  File.directory?("/etc/heroku")
362
382
  end
363
383
 
364
- def heroku_dyno_metadata_message
365
- "You are running on Heroku but haven't enabled Dyno Metadata. For Sentry's "\
366
- "release detection to work correctly, please run `heroku labs:enable runtime-dyno-metadata`"
367
- end
368
-
369
384
  def detect_release_from_capistrano
370
385
  revision_file = File.join(project_root, 'REVISION')
371
386
  revision_log = File.join(project_root, '..', 'revisions.log')
@@ -77,8 +77,8 @@ module Raven
77
77
  # @example
78
78
  # evt = Raven::Event.new(:message => "An error")
79
79
  # Raven.send_event(evt)
80
- def send_event(event)
81
- client.send_event(event)
80
+ def send_event(event, hint = nil)
81
+ client.send_event(event, hint)
82
82
  end
83
83
 
84
84
  # Capture and process any exceptions from the given block.
@@ -120,10 +120,10 @@ module Raven
120
120
  configuration.async.call(evt.to_json_compatible)
121
121
  rescue => ex
122
122
  logger.error("async event sending failed: #{ex.message}")
123
- send_event(evt)
123
+ send_event(evt, make_hint(obj))
124
124
  end
125
125
  else
126
- send_event(evt)
126
+ send_event(evt, make_hint(obj))
127
127
  end
128
128
  Thread.current["sentry_#{object_id}_last_event_id".to_sym] = evt.id
129
129
  evt
@@ -217,5 +217,9 @@ module Raven
217
217
  end
218
218
  end
219
219
  end
220
+
221
+ def make_hint(obj)
222
+ obj.is_a?(String) ? { :exception => nil, :message => obj } : { :exception => obj, :message => nil }
223
+ end
220
224
  end
221
225
  end
@@ -0,0 +1,20 @@
1
+ module Raven
2
+ module Transports
3
+ class Stdout < Transport
4
+ attr_accessor :events
5
+
6
+ def initialize(*)
7
+ super
8
+ end
9
+
10
+ def send_event(_auth_header, data, _options = {})
11
+ unless configuration.sending_allowed?
12
+ logger.debug("Event not sent: #{configuration.error_messages}")
13
+ end
14
+
15
+ $stdout.puts data
16
+ $stdout.flush
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Raven
3
3
  # Freezing this constant breaks in 1.9.x
4
- VERSION = "2.7.4" # rubocop:disable Style/MutableConstant
4
+ VERSION = "2.8.0" # rubocop:disable Style/MutableConstant
5
5
  end
@@ -12,7 +12,6 @@ Gem::Specification.new do |gem|
12
12
  gem.version = Raven::VERSION
13
13
  gem.platform = Gem::Platform::RUBY
14
14
  gem.required_ruby_version = '>= 1.9.0'
15
- gem.has_rdoc = true
16
15
  gem.extra_rdoc_files = ["README.md", "LICENSE"]
17
16
  gem.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
18
17
  gem.bindir = "exe"
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: 2.7.4
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-14 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -49,22 +49,6 @@ files:
49
49
  - README.md
50
50
  - Rakefile
51
51
  - changelog.md
52
- - docs/Makefile
53
- - docs/breadcrumbs.rst
54
- - docs/conf.py
55
- - docs/config.rst
56
- - docs/context.rst
57
- - docs/index.rst
58
- - docs/install.rst
59
- - docs/integrations/heroku.rst
60
- - docs/integrations/index.rst
61
- - docs/integrations/puma.rst
62
- - docs/integrations/rack.rst
63
- - docs/integrations/rails.rst
64
- - docs/make.bat
65
- - docs/processors.rst
66
- - docs/sentry-doc-config.json
67
- - docs/usage.rst
68
52
  - exe/raven
69
53
  - lib/raven.rb
70
54
  - lib/raven/backtrace.rb
@@ -110,6 +94,7 @@ files:
110
94
  - lib/raven/transports.rb
111
95
  - lib/raven/transports/dummy.rb
112
96
  - lib/raven/transports/http.rb
97
+ - lib/raven/transports/stdout.rb
113
98
  - lib/raven/utils/deep_merge.rb
114
99
  - lib/raven/utils/real_ip.rb
115
100
  - lib/raven/version.rb
@@ -136,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
121
  version: '0'
137
122
  requirements: []
138
123
  rubyforge_project:
139
- rubygems_version: 2.6.14
124
+ rubygems_version: 2.5.2.3
140
125
  signing_key:
141
126
  specification_version: 4
142
127
  summary: A gem that provides a client interface for the Sentry error logger
@@ -1,130 +0,0 @@
1
- # Makefile for Sphinx documentation
2
- #
3
-
4
- # You can set these variables from the command line.
5
- SPHINXOPTS =
6
- SPHINXBUILD = sphinx-build
7
- PAPER =
8
- BUILDDIR = ./_build
9
-
10
- # Internal variables.
11
- PAPEROPT_a4 = -D latex_paper_size=a4
12
- PAPEROPT_letter = -D latex_paper_size=letter
13
- ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
14
-
15
- .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
16
-
17
- help:
18
- @echo "Please use \`make <target>' where <target> is one of"
19
- @echo " html to make standalone HTML files"
20
- @echo " dirhtml to make HTML files named index.html in directories"
21
- @echo " singlehtml to make a single large HTML file"
22
- @echo " pickle to make pickle files"
23
- @echo " json to make JSON files"
24
- @echo " htmlhelp to make HTML files and a HTML help project"
25
- @echo " qthelp to make HTML files and a qthelp project"
26
- @echo " devhelp to make HTML files and a Devhelp project"
27
- @echo " epub to make an epub"
28
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
29
- @echo " latexpdf to make LaTeX files and run them through pdflatex"
30
- @echo " text to make text files"
31
- @echo " man to make manual pages"
32
- @echo " changes to make an overview of all changed/added/deprecated items"
33
- @echo " linkcheck to check all external links for integrity"
34
- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
35
-
36
- clean:
37
- -rm -rf $(BUILDDIR)/*
38
-
39
- html:
40
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
41
- @echo
42
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
43
-
44
- dirhtml:
45
- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
46
- @echo
47
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
48
-
49
- singlehtml:
50
- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
51
- @echo
52
- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
53
-
54
- pickle:
55
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
56
- @echo
57
- @echo "Build finished; now you can process the pickle files."
58
-
59
- json:
60
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
61
- @echo
62
- @echo "Build finished; now you can process the JSON files."
63
-
64
- htmlhelp:
65
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
66
- @echo
67
- @echo "Build finished; now you can run HTML Help Workshop with the" \
68
- ".hhp project file in $(BUILDDIR)/htmlhelp."
69
-
70
- qthelp:
71
- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
72
- @echo
73
- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
74
- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
75
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Sentry.qhcp"
76
- @echo "To view the help file:"
77
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Sentry.qhc"
78
-
79
- devhelp:
80
- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
81
- @echo
82
- @echo "Build finished."
83
- @echo "To view the help file:"
84
- @echo "# mkdir -p $$HOME/.local/share/devhelp/Sentry"
85
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Sentry"
86
- @echo "# devhelp"
87
-
88
- epub:
89
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
90
- @echo
91
- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
92
-
93
- latex:
94
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
95
- @echo
96
- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
97
- @echo "Run \`make' in that directory to run these through (pdf)latex" \
98
- "(use \`make latexpdf' here to do that automatically)."
99
-
100
- latexpdf:
101
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
102
- @echo "Running LaTeX files through pdflatex..."
103
- make -C $(BUILDDIR)/latex all-pdf
104
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
105
-
106
- text:
107
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
108
- @echo
109
- @echo "Build finished. The text files are in $(BUILDDIR)/text."
110
-
111
- man:
112
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
113
- @echo
114
- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
115
-
116
- changes:
117
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
118
- @echo
119
- @echo "The overview file is in $(BUILDDIR)/changes."
120
-
121
- linkcheck:
122
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
123
- @echo
124
- @echo "Link check complete; look for any errors in the above output " \
125
- "or in $(BUILDDIR)/linkcheck/output.txt."
126
-
127
- doctest:
128
- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
129
- @echo "Testing of doctests in the sources finished, look at the " \
130
- "results in $(BUILDDIR)/doctest/output.txt."