sentry-raven 2.6.3 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ module Raven
2
+ class Rails
3
+ module ControllerTransaction
4
+ def self.included(base)
5
+ base.around_action do |controller, block|
6
+ Raven.context.transaction.push "#{controller.class}##{controller.action_name}"
7
+ block.call
8
+ Raven.context.transaction.pop
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -6,7 +6,12 @@ module Rake
6
6
  class Application
7
7
  alias orig_display_error_messsage display_error_message
8
8
  def display_error_message(ex)
9
- Raven.capture_exception ex, :logger => 'rake', :tags => { 'rake_task' => top_level_tasks.join(' ') }
9
+ Raven.capture_exception(
10
+ ex,
11
+ :transaction => top_level_tasks.join(' '),
12
+ :logger => 'rake',
13
+ :tags => { 'rake_task' => top_level_tasks.join(' ') }
14
+ )
10
15
  orig_display_error_messsage(ex)
11
16
  end
12
17
  end
@@ -3,7 +3,9 @@ require 'sidekiq'
3
3
 
4
4
  module Raven
5
5
  class SidekiqCleanupMiddleware
6
- def call(_worker, _job, _queue)
6
+ def call(_worker, job, queue)
7
+ Raven.context.transaction.push "Sidekiq/#{job['class']}"
8
+ Raven.extra_context(:sidekiq => job.merge("queue" => queue))
7
9
  yield
8
10
  Context.clear!
9
11
  BreadcrumbBuffer.clear!
@@ -15,11 +17,11 @@ module Raven
15
17
 
16
18
  def call(ex, context)
17
19
  context = filter_context(context)
20
+ Raven.context.transaction.push transaction_from_context(context)
18
21
  Raven.capture_exception(
19
22
  ex,
20
23
  :message => ex.message,
21
- :extra => { :sidekiq => context },
22
- :culprit => culprit_from_context(context)
24
+ :extra => { :sidekiq => context }
23
25
  )
24
26
  Context.clear!
25
27
  BreadcrumbBuffer.clear!
@@ -51,12 +53,14 @@ module Raven
51
53
 
52
54
  # this will change in the future:
53
55
  # https://github.com/mperham/sidekiq/pull/3161
54
- def culprit_from_context(context)
55
- classname = (context["class"] || (context["job"] && (context["job"]["wrapped"] || context["job"]["class"])))
56
+ def transaction_from_context(context)
57
+ classname = (context["wrapped"] || context["class"] ||
58
+ (context[:job] && (context[:job]["wrapped"] || context[:job]["class"]))
59
+ )
56
60
  if classname
57
61
  "Sidekiq/#{classname}"
58
- elsif context["event"]
59
- "Sidekiq/#{context['event']}"
62
+ elsif context[:event]
63
+ "Sidekiq/#{context[:event]}"
60
64
  else
61
65
  "Sidekiq"
62
66
  end
@@ -1,5 +1,3 @@
1
- require 'raven/interface'
2
-
3
1
  module Raven
4
2
  class ExceptionInterface < Interface
5
3
  attr_accessor :values
@@ -1,5 +1,3 @@
1
- require 'raven/interface'
2
-
3
1
  module Raven
4
2
  class HttpInterface < Interface
5
3
  attr_accessor :url, :method, :data, :query_string, :cookies, :headers, :env
@@ -1,5 +1,3 @@
1
- require 'raven/interface'
2
-
3
1
  module Raven
4
2
  class SingleExceptionInterface < Interface
5
3
  attr_accessor :type
@@ -1,11 +1,8 @@
1
- require 'raven/interface'
2
-
3
1
  module Raven
4
2
  class StacktraceInterface < Interface
5
3
  attr_accessor :frames
6
4
 
7
5
  def initialize(*arguments)
8
- self.frames = []
9
6
  super(*arguments)
10
7
  end
11
8
 
@@ -21,24 +18,16 @@ module Raven
21
18
 
22
19
  # Not actually an interface, but I want to use the same style
23
20
  class Frame < Interface
24
- attr_accessor :abs_path
25
- attr_accessor :function
26
- attr_accessor :vars
27
- attr_accessor :pre_context
28
- attr_accessor :post_context
29
- attr_accessor :context_line
30
- attr_accessor :module
31
- attr_accessor :lineno
32
- attr_accessor :in_app
21
+ attr_accessor :abs_path, :context_line, :function, :in_app,
22
+ :lineno, :module, :pre_context, :post_context, :vars
33
23
 
34
24
  def initialize(*arguments)
35
- self.vars, self.pre_context, self.post_context = [], [], []
36
25
  super(*arguments)
37
26
  end
38
27
 
39
28
  def filename
40
29
  return if abs_path.nil?
41
- return @filename if @filename
30
+ return @filename if instance_variable_defined?(:@filename)
42
31
 
43
32
  prefix =
44
33
  if under_project_root? && in_app
@@ -4,7 +4,7 @@ require 'json'
4
4
  module Raven
5
5
  class Processor::SanitizeData < Processor
6
6
  DEFAULT_FIELDS = %w(authorization password passwd secret ssn social(.*)?sec).freeze
7
- CREDIT_CARD_RE = /^(?:\d[ -]*?){13,16}$/
7
+ CREDIT_CARD_RE = /\b(?:3[47]\d|(?:4\d|5[1-5]|65)\d{2}|6011)\d{12}\b/
8
8
  QUERY_STRING = ['query_string', :query_string].freeze
9
9
  JSON_STARTS_WITH = ["[", "{"].freeze
10
10
 
@@ -62,7 +62,7 @@ module Raven
62
62
  end
63
63
 
64
64
  def fields_re
65
- return @fields_re if @fields_re
65
+ return @fields_re if instance_variable_defined?(:@fields_re)
66
66
  fields = DEFAULT_FIELDS | sanitize_fields
67
67
  fields -= sanitize_fields_excluded
68
68
  @fields_re = /#{fields.map do |f|
@@ -23,6 +23,7 @@ module Raven
23
23
  # so instead we check if it only contains actual ASCII codepoints, and if
24
24
  # not we assume it's actually just UTF8 and scrub accordingly.
25
25
  if value.encoding == Encoding::BINARY && !value.ascii_only?
26
+ value = value.dup
26
27
  value.force_encoding(Encoding::UTF_8)
27
28
  end
28
29
  return value if value.valid_encoding?
@@ -1,5 +1,3 @@
1
- require 'raven/error'
2
-
3
1
  module Raven
4
2
  module Transports
5
3
  class Transport
@@ -1,7 +1,6 @@
1
1
  require 'faraday'
2
2
 
3
3
  require 'raven/transports'
4
- require 'raven/error'
5
4
 
6
5
  module Raven
7
6
  module Transports
@@ -1,4 +1,3 @@
1
- # rubocop:disable all
2
1
  module Raven
3
2
  module Utils
4
3
  # ported from ActiveSupport
@@ -8,23 +7,16 @@ module Raven
8
7
  end
9
8
 
10
9
  def self.deep_merge!(hash, other_hash, &block)
11
- other_hash.each_pair do |current_key, other_value|
12
- this_value = hash[current_key]
13
-
14
- hash[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash)
15
- deep_merge(this_value, other_value, &block)
10
+ hash.merge!(other_hash) do |key, this_val, other_val|
11
+ if this_val.is_a?(Hash) && other_val.is_a?(Hash)
12
+ deep_merge(this_val, other_val, &block)
13
+ elsif block_given?
14
+ block.call(key, this_val, other_val)
16
15
  else
17
- if block_given? && key?(current_key)
18
- block.call(current_key, this_value, other_value)
19
- else
20
- other_value
21
- end
16
+ other_val
22
17
  end
23
18
  end
24
-
25
- hash
26
19
  end
27
20
  end
28
21
  end
29
22
  end
30
- # rubocop:enable all
@@ -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.6.3" # rubocop:disable Style/MutableConstant
4
+ VERSION = "2.7.1" # rubocop:disable Style/MutableConstant
5
5
  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: 2.6.3
4
+ version: 2.7.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: 2017-08-07 00:00:00.000000000 Z
11
+ date: 2017-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -62,6 +62,7 @@ files:
62
62
  - docs/integrations/rack.rst
63
63
  - docs/integrations/rails.rst
64
64
  - docs/make.bat
65
+ - docs/processors.rst
65
66
  - docs/sentry-doc-config.json
66
67
  - docs/usage.rst
67
68
  - exe/raven
@@ -75,7 +76,6 @@ files:
75
76
  - lib/raven/client.rb
76
77
  - lib/raven/configuration.rb
77
78
  - lib/raven/context.rb
78
- - lib/raven/error.rb
79
79
  - lib/raven/event.rb
80
80
  - lib/raven/instance.rb
81
81
  - lib/raven/integrations/delayed_job.rb
@@ -84,6 +84,7 @@ files:
84
84
  - lib/raven/integrations/rails.rb
85
85
  - lib/raven/integrations/rails/active_job.rb
86
86
  - lib/raven/integrations/rails/controller_methods.rb
87
+ - lib/raven/integrations/rails/controller_transaction.rb
87
88
  - lib/raven/integrations/rails/overrides/debug_exceptions_catcher.rb
88
89
  - lib/raven/integrations/rails/overrides/streaming_reporter.rb
89
90
  - lib/raven/integrations/railties.rb
@@ -135,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
136
  version: '0'
136
137
  requirements: []
137
138
  rubyforge_project:
138
- rubygems_version: 2.6.11
139
+ rubygems_version: 2.6.13
139
140
  signing_key:
140
141
  specification_version: 4
141
142
  summary: A gem that provides a client interface for the Sentry error logger
@@ -1,4 +0,0 @@
1
- module Raven
2
- class Error < StandardError
3
- end
4
- end