bugsnag 6.16.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +11 -0
- data/CHANGELOG.md +10 -0
- data/VERSION +1 -1
- data/bugsnag.gemspec +1 -1
- data/lib/bugsnag.rb +26 -6
- data/lib/bugsnag/configuration.rb +133 -23
- data/lib/bugsnag/integrations/resque.rb +10 -3
- data/lib/bugsnag/integrations/sidekiq.rb +0 -1
- data/lib/bugsnag/report.rb +83 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7bc3da7c0b78fcf5ccdccee2cc11c2da66b0ed121efd6ee4959c3defa4faf78b
         | 
| 4 | 
            +
              data.tar.gz: 9ee38d85d5156b4820782f54076f4209c5adf333505f701e9498ed0eafd99a1a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6962b73237abdfed471b6fdb835a0fb57f6360dc86efa4c8bd2049c0c354332a214626a48c700e9e0edf29c6848678883d3cddd9bcc040b42057a6e7d03f2fe5
         | 
| 7 | 
            +
              data.tar.gz: 5e1a14700a57fc44f3d9ad9cf6f6208fe26a1bc590b92e56a56b5a5352891c7e75dd29c28a01a0edf7e297a23bb0728f5484205119a4476e768306e415db6fde
         | 
    
        data/.yardopts
    ADDED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,6 +1,16 @@ | |
| 1 1 | 
             
            Changelog
         | 
| 2 2 | 
             
            =========
         | 
| 3 3 |  | 
| 4 | 
            +
            ## 6.17.0 (27 August 2020)
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            ### Enhancements
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            * Sidekiq now uses `thread_queue` delivery by default
         | 
| 9 | 
            +
              | [#626](https://github.com/bugsnag/bugsnag-ruby/pull/626)
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            * Rescue now uses `thread_queue` delivery when `at_exit` hooks are enabled
         | 
| 12 | 
            +
              | [#629](https://github.com/bugsnag/bugsnag-ruby/pull/629)
         | 
| 13 | 
            +
             | 
| 4 14 | 
             
            ## 6.16.0 (12 August 2020)
         | 
| 5 15 |  | 
| 6 16 | 
             
            ### Enhancements
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            6. | 
| 1 | 
            +
            6.17.0
         | 
    
        data/bugsnag.gemspec
    CHANGED
    
    | @@ -10,7 +10,7 @@ Gem::Specification.new do |s| | |
| 10 10 | 
             
              s.homepage = "https://github.com/bugsnag/bugsnag-ruby"
         | 
| 11 11 | 
             
              s.licenses = ["MIT"]
         | 
| 12 12 |  | 
| 13 | 
            -
              s.files = `git ls-files -z lib bugsnag.gemspec VERSION`.split("\x0")
         | 
| 13 | 
            +
              s.files = `git ls-files -z lib bugsnag.gemspec VERSION .yardopts`.split("\x0")
         | 
| 14 14 | 
             
              s.extra_rdoc_files = [
         | 
| 15 15 | 
             
                "LICENSE.txt",
         | 
| 16 16 | 
             
                "README.md",
         | 
    
        data/lib/bugsnag.rb
    CHANGED
    
    | @@ -44,7 +44,10 @@ module Bugsnag | |
| 44 44 | 
             
                ##
         | 
| 45 45 | 
             
                # Configure the Bugsnag notifier application-wide settings.
         | 
| 46 46 | 
             
                #
         | 
| 47 | 
            -
                # Yields a  | 
| 47 | 
            +
                # Yields a {Configuration} object to use to set application settings.
         | 
| 48 | 
            +
                #
         | 
| 49 | 
            +
                # @yieldparam configuration [Configuration]
         | 
| 50 | 
            +
                # @return [void]
         | 
| 48 51 | 
             
                def configure(validate_api_key=true)
         | 
| 49 52 | 
             
                  yield(configuration) if block_given?
         | 
| 50 53 |  | 
| @@ -125,7 +128,9 @@ module Bugsnag | |
| 125 128 | 
             
                end
         | 
| 126 129 |  | 
| 127 130 | 
             
                ##
         | 
| 128 | 
            -
                # Registers an at_exit function to automatically catch errors on exit
         | 
| 131 | 
            +
                # Registers an at_exit function to automatically catch errors on exit.
         | 
| 132 | 
            +
                #
         | 
| 133 | 
            +
                # @return [void]
         | 
| 129 134 | 
             
                def register_at_exit
         | 
| 130 135 | 
             
                  return if at_exit_handler_installed?
         | 
| 131 136 | 
             
                  @exit_handler_added = true
         | 
| @@ -142,14 +147,19 @@ module Bugsnag | |
| 142 147 | 
             
                end
         | 
| 143 148 |  | 
| 144 149 | 
             
                ##
         | 
| 145 | 
            -
                # Checks if an at_exit handler has been added
         | 
| 150 | 
            +
                # Checks if an at_exit handler has been added.
         | 
| 151 | 
            +
                #
         | 
| 152 | 
            +
                # The {Bugsnag#configure} method will add this automatically, but it can be
         | 
| 153 | 
            +
                # added manually using {Bugsnag#register_at_exit}.
         | 
| 154 | 
            +
                #
         | 
| 155 | 
            +
                # @return [Boolean]
         | 
| 146 156 | 
             
                def at_exit_handler_installed?
         | 
| 147 157 | 
             
                  @exit_handler_added ||= false
         | 
| 148 158 | 
             
                end
         | 
| 149 159 |  | 
| 150 | 
            -
                # Configuration getters
         | 
| 151 160 | 
             
                ##
         | 
| 152 161 | 
             
                # Returns the client's Configuration object, or creates one if not yet created.
         | 
| 162 | 
            +
                #
         | 
| 153 163 | 
             
                # @return [Configuration]
         | 
| 154 164 | 
             
                def configuration
         | 
| 155 165 | 
             
                  @configuration = nil unless defined?(@configuration)
         | 
| @@ -158,6 +168,8 @@ module Bugsnag | |
| 158 168 |  | 
| 159 169 | 
             
                ##
         | 
| 160 170 | 
             
                # Returns the client's SessionTracker object, or creates one if not yet created.
         | 
| 171 | 
            +
                #
         | 
| 172 | 
            +
                # @return [SessionTracker]
         | 
| 161 173 | 
             
                def session_tracker
         | 
| 162 174 | 
             
                  @session_tracker = nil unless defined?(@session_tracker)
         | 
| 163 175 | 
             
                  @session_tracker || LOCK.synchronize { @session_tracker ||= Bugsnag::SessionTracker.new}
         | 
| @@ -181,7 +193,10 @@ module Bugsnag | |
| 181 193 | 
             
                  Bugsnag.configuration.request_data[:before_callbacks] ||= []
         | 
| 182 194 | 
             
                end
         | 
| 183 195 |  | 
| 184 | 
            -
                 | 
| 196 | 
            +
                ##
         | 
| 197 | 
            +
                # Attempts to load all integrations through auto-discovery.
         | 
| 198 | 
            +
                #
         | 
| 199 | 
            +
                # @return [void]
         | 
| 185 200 | 
             
                def load_integrations
         | 
| 186 201 | 
             
                  require "bugsnag/integrations/railtie" if defined?(Rails::Railtie)
         | 
| 187 202 | 
             
                  INTEGRATIONS.each do |integration|
         | 
| @@ -192,7 +207,11 @@ module Bugsnag | |
| 192 207 | 
             
                  end
         | 
| 193 208 | 
             
                end
         | 
| 194 209 |  | 
| 195 | 
            -
                 | 
| 210 | 
            +
                ##
         | 
| 211 | 
            +
                # Load a specific integration.
         | 
| 212 | 
            +
                #
         | 
| 213 | 
            +
                # @param integration [Symbol] One of the integrations in {INTEGRATIONS}
         | 
| 214 | 
            +
                # @return [void]
         | 
| 196 215 | 
             
                def load_integration(integration)
         | 
| 197 216 | 
             
                  integration = :railtie if integration == :rails
         | 
| 198 217 | 
             
                  if INTEGRATIONS.include?(integration) || integration == :railtie
         | 
| @@ -209,6 +228,7 @@ module Bugsnag | |
| 209 228 | 
             
                # @param meta_data [Hash] String, Numeric, or Boolean meta data to attach
         | 
| 210 229 | 
             
                # @param type [String] the breadcrumb type, from Bugsnag::Breadcrumbs::VALID_BREADCRUMB_TYPES
         | 
| 211 230 | 
             
                # @param auto [Symbol] set to :auto if the breadcrumb is automatically created
         | 
| 231 | 
            +
                # @return [void]
         | 
| 212 232 | 
             
                def leave_breadcrumb(name, meta_data={}, type=Bugsnag::Breadcrumbs::MANUAL_BREADCRUMB_TYPE, auto=:manual)
         | 
| 213 233 | 
             
                  breadcrumb = Bugsnag::Breadcrumbs::Breadcrumb.new(name, type, meta_data, auto)
         | 
| 214 234 | 
             
                  validator = Bugsnag::Breadcrumbs::Validator.new(configuration)
         | 
| @@ -15,64 +15,134 @@ require "bugsnag/breadcrumbs/breadcrumbs" | |
| 15 15 |  | 
| 16 16 | 
             
            module Bugsnag
         | 
| 17 17 | 
             
              class Configuration
         | 
| 18 | 
            +
                # Your Integration API Key
         | 
| 19 | 
            +
                # @return [String, nil]
         | 
| 18 20 | 
             
                attr_accessor :api_key
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                # The current stage of the release process, e.g. 'development', production'
         | 
| 23 | 
            +
                # @return [String, nil]
         | 
| 19 24 | 
             
                attr_accessor :release_stage
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                # A list of which release stages should cause notifications to be sent
         | 
| 27 | 
            +
                # @return [Array<String>, nil]
         | 
| 20 28 | 
             
                attr_accessor :notify_release_stages
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                # Whether notifications should automatically be sent
         | 
| 31 | 
            +
                # @return [Boolean]
         | 
| 21 32 | 
             
                attr_accessor :auto_notify
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                # @return [String, nil]
         | 
| 22 35 | 
             
                attr_accessor :ca_file
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                # Whether to automatically attach the Rack environment to notifications
         | 
| 38 | 
            +
                # @return [Boolean]
         | 
| 23 39 | 
             
                attr_accessor :send_environment
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                # Whether code snippets from the exception stacktrace should be sent with notifications
         | 
| 42 | 
            +
                # @return [Boolean]
         | 
| 24 43 | 
             
                attr_accessor :send_code
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                # Any stacktrace lines that match this path will be marked as 'in project'
         | 
| 46 | 
            +
                # @return [String, nil]
         | 
| 25 47 | 
             
                attr_accessor :project_root
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                # The current version of your application
         | 
| 50 | 
            +
                # @return [String, nil]
         | 
| 26 51 | 
             
                attr_accessor :app_version
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                # A list of keys that should be filtered out from the report and breadcrumb
         | 
| 54 | 
            +
                # metadata before sending them to Bugsnag
         | 
| 55 | 
            +
                # @return [Set<String, Regexp>]
         | 
| 27 56 | 
             
                attr_accessor :meta_data_filters
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                # The logger to use for Bugsnag log messages
         | 
| 59 | 
            +
                # @return [Logger]
         | 
| 28 60 | 
             
                attr_accessor :logger
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                # The middleware stack that will run on every notification
         | 
| 63 | 
            +
                # @return [MiddlewareStack]
         | 
| 29 64 | 
             
                attr_accessor :middleware
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                # @api private
         | 
| 67 | 
            +
                # @return [MiddlewareStack]
         | 
| 30 68 | 
             
                attr_accessor :internal_middleware
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                # The host address of the HTTP proxy that should be used when making requests
         | 
| 71 | 
            +
                # @see parse_proxy
         | 
| 72 | 
            +
                # @return [String, nil]
         | 
| 31 73 | 
             
                attr_accessor :proxy_host
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                # The port number of the HTTP proxy that should be used when making requests
         | 
| 76 | 
            +
                # @see parse_proxy
         | 
| 77 | 
            +
                # @return [Integer, nil]
         | 
| 32 78 | 
             
                attr_accessor :proxy_port
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                # The user that should be used when making requests via a HTTP proxy
         | 
| 81 | 
            +
                # @see parse_proxy
         | 
| 82 | 
            +
                # @return [String, nil]
         | 
| 33 83 | 
             
                attr_accessor :proxy_user
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                # The password for the user that should be used when making requests via a HTTP proxy
         | 
| 86 | 
            +
                # @see parse_proxy
         | 
| 87 | 
            +
                # @return [String, nil]
         | 
| 34 88 | 
             
                attr_accessor :proxy_password
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                # The HTTP request timeout, defaults to 15 seconds
         | 
| 91 | 
            +
                # @return [Integer]
         | 
| 35 92 | 
             
                attr_accessor :timeout
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                # The name or descriptor of the Ruby server host
         | 
| 95 | 
            +
                # @return [String]
         | 
| 36 96 | 
             
                attr_accessor :hostname
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                # @api private
         | 
| 99 | 
            +
                # @return [Hash{String => String}]
         | 
| 37 100 | 
             
                attr_accessor :runtime_versions
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                # Exception classes that will be discarded and not sent to Bugsnag
         | 
| 103 | 
            +
                # @return [Set<String, Regexp>]
         | 
| 38 104 | 
             
                attr_accessor :discard_classes
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                # Whether Bugsnag should automatically record sessions
         | 
| 107 | 
            +
                # @return [Boolean]
         | 
| 39 108 | 
             
                attr_accessor :auto_capture_sessions
         | 
| 40 109 |  | 
| 41 | 
            -
                ##
         | 
| 42 110 | 
             
                # @deprecated Use {#discard_classes} instead
         | 
| 111 | 
            +
                # @return [Set<Class, Proc>]
         | 
| 43 112 | 
             
                attr_accessor :ignore_classes
         | 
| 44 113 |  | 
| 45 | 
            -
                 | 
| 46 | 
            -
                # @return [String] | 
| 114 | 
            +
                # The URL error notifications will be delivered to
         | 
| 115 | 
            +
                # @return [String]
         | 
| 47 116 | 
             
                attr_reader :notify_endpoint
         | 
| 48 117 | 
             
                alias :endpoint :notify_endpoint
         | 
| 49 118 |  | 
| 50 | 
            -
                 | 
| 51 | 
            -
                # @return [String] | 
| 119 | 
            +
                # The URL session notifications will be delivered to
         | 
| 120 | 
            +
                # @return [String]
         | 
| 52 121 | 
             
                attr_reader :session_endpoint
         | 
| 53 122 |  | 
| 54 | 
            -
                 | 
| 55 | 
            -
                # @return [Boolean] | 
| 123 | 
            +
                # Whether sessions will be delivered
         | 
| 124 | 
            +
                # @return [Boolean]
         | 
| 56 125 | 
             
                attr_reader :enable_sessions
         | 
| 57 126 |  | 
| 58 | 
            -
                 | 
| 59 | 
            -
                # @ | 
| 127 | 
            +
                # A list of strings indicating allowable automatic breadcrumb types
         | 
| 128 | 
            +
                # @see Bugsnag::Breadcrumbs::VALID_BREADCRUMB_TYPES
         | 
| 129 | 
            +
                # @return [Array<String>]
         | 
| 60 130 | 
             
                attr_accessor :enabled_automatic_breadcrumb_types
         | 
| 61 131 |  | 
| 62 | 
            -
                 | 
| 63 | 
            -
                # @return [Array<#call>] | 
| 132 | 
            +
                # Callables to be run before a breadcrumb is logged
         | 
| 133 | 
            +
                # @return [Array<#call>]
         | 
| 64 134 | 
             
                attr_accessor :before_breadcrumb_callbacks
         | 
| 65 135 |  | 
| 66 | 
            -
                 | 
| 67 | 
            -
                # @return [Integer] | 
| 136 | 
            +
                # The maximum allowable amount of breadcrumbs per thread
         | 
| 137 | 
            +
                # @return [Integer]
         | 
| 68 138 | 
             
                attr_reader :max_breadcrumbs
         | 
| 69 139 |  | 
| 70 | 
            -
                 | 
| 71 | 
            -
                # @return [Regexp] | 
| 140 | 
            +
                #
         | 
| 141 | 
            +
                # @return [Regexp]
         | 
| 72 142 | 
             
                attr_accessor :vendor_path
         | 
| 73 143 |  | 
| 74 | 
            -
                 | 
| 75 | 
            -
                # @return [Array]
         | 
| 144 | 
            +
                # @api private
         | 
| 145 | 
            +
                # @return [Array<String>]
         | 
| 76 146 | 
             
                attr_reader :scopes_to_filter
         | 
| 77 147 |  | 
| 78 148 | 
             
                API_KEY_REGEX = /[0-9a-f]{32}/i
         | 
| @@ -96,6 +166,7 @@ module Bugsnag | |
| 96 166 | 
             
                # Path to vendored code. Used to mark file paths as out of project.
         | 
| 97 167 | 
             
                DEFAULT_VENDOR_PATH = %r{^(vendor/|\.bundle/)}
         | 
| 98 168 |  | 
| 169 | 
            +
                # @api private
         | 
| 99 170 | 
             
                DEFAULT_SCOPES_TO_FILTER = ['events.metaData', 'events.breadcrumbs.metaData'].freeze
         | 
| 100 171 |  | 
| 101 172 | 
             
                alias :track_sessions :auto_capture_sessions
         | 
| @@ -177,6 +248,7 @@ module Bugsnag | |
| 177 248 | 
             
                # Gets the delivery_method that Bugsnag will use to communicate with the
         | 
| 178 249 | 
             
                # notification endpoint.
         | 
| 179 250 | 
             
                #
         | 
| 251 | 
            +
                # @return [Symbol]
         | 
| 180 252 | 
             
                def delivery_method
         | 
| 181 253 | 
             
                  @delivery_method || @default_delivery_method || :thread_queue
         | 
| 182 254 | 
             
                end
         | 
| @@ -185,6 +257,10 @@ module Bugsnag | |
| 185 257 | 
             
                # Sets the delivery_method that Bugsnag will use to communicate with the
         | 
| 186 258 | 
             
                # notification endpoint.
         | 
| 187 259 | 
             
                #
         | 
| 260 | 
            +
                # The default delivery methods are ':thread_queue' and ':synchronous'.
         | 
| 261 | 
            +
                #
         | 
| 262 | 
            +
                # @param delivery_method [Symbol]
         | 
| 263 | 
            +
                # @return [void]
         | 
| 188 264 | 
             
                def delivery_method=(delivery_method)
         | 
| 189 265 | 
             
                  @delivery_method = delivery_method
         | 
| 190 266 | 
             
                end
         | 
| @@ -193,6 +269,10 @@ module Bugsnag | |
| 193 269 | 
             
                # Used to set a new default delivery method that will be used if one is not
         | 
| 194 270 | 
             
                # set with #delivery_method.
         | 
| 195 271 | 
             
                #
         | 
| 272 | 
            +
                # @api private
         | 
| 273 | 
            +
                #
         | 
| 274 | 
            +
                # @param delivery_method [Symbol]
         | 
| 275 | 
            +
                # @return [void]
         | 
| 196 276 | 
             
                def default_delivery_method=(delivery_method)
         | 
| 197 277 | 
             
                  @default_delivery_method = delivery_method
         | 
| 198 278 | 
             
                end
         | 
| @@ -248,12 +328,16 @@ module Bugsnag | |
| 248 328 | 
             
                ##
         | 
| 249 329 | 
             
                # Indicates whether the notifier should send a notification based on the
         | 
| 250 330 | 
             
                # configured release stage.
         | 
| 331 | 
            +
                #
         | 
| 332 | 
            +
                # @return [Boolean]
         | 
| 251 333 | 
             
                def should_notify_release_stage?
         | 
| 252 334 | 
             
                  @release_stage.nil? || @notify_release_stages.nil? || @notify_release_stages.include?(@release_stage)
         | 
| 253 335 | 
             
                end
         | 
| 254 336 |  | 
| 255 337 | 
             
                ##
         | 
| 256 338 | 
             
                # Tests whether the configured API key is valid.
         | 
| 339 | 
            +
                #
         | 
| 340 | 
            +
                # @return [Boolean]
         | 
| 257 341 | 
             
                def valid_api_key?
         | 
| 258 342 | 
             
                  !api_key.nil? && api_key =~ API_KEY_REGEX
         | 
| 259 343 | 
             
                end
         | 
| @@ -261,48 +345,68 @@ module Bugsnag | |
| 261 345 | 
             
                ##
         | 
| 262 346 | 
             
                # Returns the array of data that will be automatically attached to every
         | 
| 263 347 | 
             
                # error notification.
         | 
| 348 | 
            +
                #
         | 
| 349 | 
            +
                # @return [Hash]
         | 
| 264 350 | 
             
                def request_data
         | 
| 265 351 | 
             
                  Thread.current[THREAD_LOCAL_NAME] ||= {}
         | 
| 266 352 | 
             
                end
         | 
| 267 353 |  | 
| 268 354 | 
             
                ##
         | 
| 269 355 | 
             
                # Sets an entry in the array of data attached to every error notification.
         | 
| 356 | 
            +
                #
         | 
| 357 | 
            +
                # @param key [String, #to_s]
         | 
| 358 | 
            +
                # @param value [Object]
         | 
| 359 | 
            +
                # @return [void]
         | 
| 270 360 | 
             
                def set_request_data(key, value)
         | 
| 271 361 | 
             
                  self.request_data[key] = value
         | 
| 272 362 | 
             
                end
         | 
| 273 363 |  | 
| 274 364 | 
             
                ##
         | 
| 275 365 | 
             
                # Unsets an entry in the array of data attached to every error notification.
         | 
| 366 | 
            +
                #
         | 
| 367 | 
            +
                # @param (see set_request_data)
         | 
| 368 | 
            +
                # @return [void]
         | 
| 276 369 | 
             
                def unset_request_data(key, value)
         | 
| 277 370 | 
             
                  self.request_data.delete(key)
         | 
| 278 371 | 
             
                end
         | 
| 279 372 |  | 
| 280 373 | 
             
                ##
         | 
| 281 374 | 
             
                # Clears the array of data attached to every error notification.
         | 
| 375 | 
            +
                #
         | 
| 376 | 
            +
                # @return [void]
         | 
| 282 377 | 
             
                def clear_request_data
         | 
| 283 378 | 
             
                  Thread.current[THREAD_LOCAL_NAME] = nil
         | 
| 284 379 | 
             
                end
         | 
| 285 380 |  | 
| 286 381 | 
             
                ##
         | 
| 287 382 | 
             
                # Logs an info level message
         | 
| 383 | 
            +
                #
         | 
| 384 | 
            +
                # @param message [String, #to_s] The message to log
         | 
| 288 385 | 
             
                def info(message)
         | 
| 289 386 | 
             
                  logger.info(PROG_NAME) { message }
         | 
| 290 387 | 
             
                end
         | 
| 291 388 |  | 
| 292 389 | 
             
                ##
         | 
| 293 390 | 
             
                # Logs a warning level message
         | 
| 391 | 
            +
                #
         | 
| 392 | 
            +
                # @param (see info)
         | 
| 294 393 | 
             
                def warn(message)
         | 
| 295 394 | 
             
                  logger.warn(PROG_NAME) { message }
         | 
| 296 395 | 
             
                end
         | 
| 297 396 |  | 
| 298 397 | 
             
                ##
         | 
| 299 398 | 
             
                # Logs a debug level message
         | 
| 399 | 
            +
                #
         | 
| 400 | 
            +
                # @param (see info)
         | 
| 300 401 | 
             
                def debug(message)
         | 
| 301 402 | 
             
                  logger.debug(PROG_NAME) { message }
         | 
| 302 403 | 
             
                end
         | 
| 303 404 |  | 
| 304 405 | 
             
                ##
         | 
| 305 406 | 
             
                # Parses and sets proxy from a uri
         | 
| 407 | 
            +
                #
         | 
| 408 | 
            +
                # @param uri [String, #to_s] The URI to parse and extract proxy details from
         | 
| 409 | 
            +
                # @return [void]
         | 
| 306 410 | 
             
                def parse_proxy(uri)
         | 
| 307 411 | 
             
                  proxy = URI.parse(uri)
         | 
| 308 412 | 
             
                  self.proxy_host = proxy.host
         | 
| @@ -314,7 +418,8 @@ module Bugsnag | |
| 314 418 | 
             
                ##
         | 
| 315 419 | 
             
                # Sets the maximum allowable amount of breadcrumbs
         | 
| 316 420 | 
             
                #
         | 
| 317 | 
            -
                # @param [Integer] the new maximum breadcrumb limit
         | 
| 421 | 
            +
                # @param new_max_breadcrumbs [Integer] the new maximum breadcrumb limit
         | 
| 422 | 
            +
                # @return [void]
         | 
| 318 423 | 
             
                def max_breadcrumbs=(new_max_breadcrumbs)
         | 
| 319 424 | 
             
                  @max_breadcrumbs = new_max_breadcrumbs
         | 
| 320 425 | 
             
                  breadcrumbs.max_items = new_max_breadcrumbs
         | 
| @@ -330,9 +435,10 @@ module Bugsnag | |
| 330 435 |  | 
| 331 436 | 
             
                # Sets the notification endpoint
         | 
| 332 437 | 
             
                #
         | 
| 333 | 
            -
                # @param new_notify_endpoint [String] The URL to deliver error notifications to
         | 
| 334 | 
            -
                #
         | 
| 335 438 | 
             
                # @deprecated Use {#set_endpoints} instead
         | 
| 439 | 
            +
                #
         | 
| 440 | 
            +
                # @param new_notify_endpoint [String] The URL to deliver error notifications to
         | 
| 441 | 
            +
                # @return [void]
         | 
| 336 442 | 
             
                def endpoint=(new_notify_endpoint)
         | 
| 337 443 | 
             
                  warn("The 'endpoint' configuration option is deprecated. The 'set_endpoints' method should be used instead")
         | 
| 338 444 | 
             
                  set_endpoints(new_notify_endpoint, session_endpoint) # Pass the existing session_endpoint through so it doesn't get overwritten
         | 
| @@ -341,9 +447,10 @@ module Bugsnag | |
| 341 447 | 
             
                ##
         | 
| 342 448 | 
             
                # Sets the sessions endpoint
         | 
| 343 449 | 
             
                #
         | 
| 344 | 
            -
                # @param new_session_endpoint [String] The URL to deliver session notifications to
         | 
| 345 | 
            -
                #
         | 
| 346 450 | 
             
                # @deprecated Use {#set_endpoints} instead
         | 
| 451 | 
            +
                #
         | 
| 452 | 
            +
                # @param new_session_endpoint [String] The URL to deliver session notifications to
         | 
| 453 | 
            +
                # @return [void]
         | 
| 347 454 | 
             
                def session_endpoint=(new_session_endpoint)
         | 
| 348 455 | 
             
                  warn("The 'session_endpoint' configuration option is deprecated. The 'set_endpoints' method should be used instead")
         | 
| 349 456 | 
             
                  set_endpoints(notify_endpoint, new_session_endpoint) # Pass the existing notify_endpoint through so it doesn't get overwritten
         | 
| @@ -354,13 +461,16 @@ module Bugsnag | |
| 354 461 | 
             
                #
         | 
| 355 462 | 
             
                # @param new_notify_endpoint [String] The URL to deliver error notifications to
         | 
| 356 463 | 
             
                # @param new_session_endpoint [String] The URL to deliver session notifications to
         | 
| 464 | 
            +
                # @return [void]
         | 
| 357 465 | 
             
                def set_endpoints(new_notify_endpoint, new_session_endpoint)
         | 
| 358 466 | 
             
                  @notify_endpoint = new_notify_endpoint
         | 
| 359 467 | 
             
                  @session_endpoint = new_session_endpoint
         | 
| 360 468 | 
             
                end
         | 
| 361 469 |  | 
| 362 470 | 
             
                ##
         | 
| 363 | 
            -
                # Disables session tracking and delivery. | 
| 471 | 
            +
                # Disables session tracking and delivery. Cannot be undone
         | 
| 472 | 
            +
                #
         | 
| 473 | 
            +
                # @return [void]
         | 
| 364 474 | 
             
                def disable_sessions
         | 
| 365 475 | 
             
                  self.auto_capture_sessions = false
         | 
| 366 476 | 
             
                  @enable_sessions = false
         | 
| @@ -58,16 +58,23 @@ Resque::Failure::Bugsnag = Bugsnag::Resque | |
| 58 58 | 
             
            # Auto-load the failure backend
         | 
| 59 59 | 
             
            Bugsnag::Resque.add_failure_backend
         | 
| 60 60 |  | 
| 61 | 
            -
             | 
| 61 | 
            +
            worker = Resque::Worker.new(:bugsnag_fork_check)
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            # If at_exit hooks are not enabled then we can't use the thread queue delivery
         | 
| 64 | 
            +
            # method because it relies on an at_exit hook to ensure the queue is flushed
         | 
| 65 | 
            +
            can_use_thread_queue = worker.respond_to?(:run_at_exit_hooks) && worker.run_at_exit_hooks
         | 
| 66 | 
            +
            default_delivery_method = can_use_thread_queue ? :thread_queue : :synchronous
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            if worker.fork_per_job?
         | 
| 62 69 | 
             
              Resque.after_fork do
         | 
| 63 70 | 
             
                Bugsnag.configuration.detected_app_type = "resque"
         | 
| 64 | 
            -
                Bugsnag.configuration.default_delivery_method =  | 
| 71 | 
            +
                Bugsnag.configuration.default_delivery_method = default_delivery_method
         | 
| 65 72 | 
             
                Bugsnag.configuration.runtime_versions["resque"] = ::Resque::VERSION
         | 
| 66 73 | 
             
              end
         | 
| 67 74 | 
             
            else
         | 
| 68 75 | 
             
              Resque.before_first_fork do
         | 
| 69 76 | 
             
                Bugsnag.configuration.detected_app_type = "resque"
         | 
| 70 | 
            -
                Bugsnag.configuration.default_delivery_method =  | 
| 77 | 
            +
                Bugsnag.configuration.default_delivery_method = default_delivery_method
         | 
| 71 78 | 
             
                Bugsnag.configuration.runtime_versions["resque"] = ::Resque::VERSION
         | 
| 72 79 | 
             
              end
         | 
| 73 80 | 
             
            end
         | 
| @@ -14,7 +14,6 @@ module Bugsnag | |
| 14 14 | 
             
                def initialize
         | 
| 15 15 | 
             
                  Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Sidekiq)
         | 
| 16 16 | 
             
                  Bugsnag.configuration.detected_app_type = "sidekiq"
         | 
| 17 | 
            -
                  Bugsnag.configuration.default_delivery_method = :synchronous
         | 
| 18 17 | 
             
                  Bugsnag.configuration.runtime_versions["sidekiq"] = ::Sidekiq::VERSION
         | 
| 19 18 | 
             
                end
         | 
| 20 19 |  | 
    
        data/lib/bugsnag/report.rb
    CHANGED
    
    | @@ -19,24 +19,87 @@ module Bugsnag | |
| 19 19 |  | 
| 20 20 | 
             
                CURRENT_PAYLOAD_VERSION = "4.0"
         | 
| 21 21 |  | 
| 22 | 
            -
                 | 
| 22 | 
            +
                # Whether this report is for a handled or unhandled error
         | 
| 23 | 
            +
                # @return [Boolean]
         | 
| 24 | 
            +
                attr_reader :unhandled
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                # Your Integration API Key
         | 
| 27 | 
            +
                # @see Configuration#api_key
         | 
| 28 | 
            +
                # @return [String, nil]
         | 
| 23 29 | 
             
                attr_accessor :api_key
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                # The type of application executing the current code
         | 
| 32 | 
            +
                # @see Configuration#app_type
         | 
| 33 | 
            +
                # @return [String, nil]
         | 
| 24 34 | 
             
                attr_accessor :app_type
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                # The current version of your application
         | 
| 37 | 
            +
                # @return [String, nil]
         | 
| 25 38 | 
             
                attr_accessor :app_version
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                # The list of breadcrumbs attached to this report
         | 
| 41 | 
            +
                # @return [Array<Breadcrumb>]
         | 
| 26 42 | 
             
                attr_accessor :breadcrumbs
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                # @api private
         | 
| 45 | 
            +
                # @return [Configuration]
         | 
| 27 46 | 
             
                attr_accessor :configuration
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                # Additional context for this report
         | 
| 49 | 
            +
                # @return [String, nil]
         | 
| 28 50 | 
             
                attr_accessor :context
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                # The delivery method that will be used for this report
         | 
| 53 | 
            +
                # @see Configuration#delivery_method
         | 
| 54 | 
            +
                # @return [Symbol]
         | 
| 29 55 | 
             
                attr_accessor :delivery_method
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                # The list of exceptions in this report
         | 
| 58 | 
            +
                # @return [Array<Hash>]
         | 
| 30 59 | 
             
                attr_accessor :exceptions
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                # @see Configuration#hostname
         | 
| 62 | 
            +
                # @return [String]
         | 
| 31 63 | 
             
                attr_accessor :hostname
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                # @api private
         | 
| 66 | 
            +
                # @see Configuration#runtime_versions
         | 
| 67 | 
            +
                # @return [Hash{String => String}]
         | 
| 32 68 | 
             
                attr_accessor :runtime_versions
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                # All errors with the same grouping hash will be grouped in the Bugsnag app
         | 
| 71 | 
            +
                # @return [String]
         | 
| 33 72 | 
             
                attr_accessor :grouping_hash
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                # Arbitrary metadata attached to this report
         | 
| 75 | 
            +
                # @return [Hash]
         | 
| 34 76 | 
             
                attr_accessor :meta_data
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                # The raw Exception instances for this report
         | 
| 79 | 
            +
                # @see #exceptions
         | 
| 80 | 
            +
                # @return [Array<Exception>]
         | 
| 35 81 | 
             
                attr_accessor :raw_exceptions
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                # The current stage of the release process, e.g. 'development', production'
         | 
| 84 | 
            +
                # @see Configuration#release_stage
         | 
| 85 | 
            +
                # @return [String, nil]
         | 
| 36 86 | 
             
                attr_accessor :release_stage
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                # The session that active when this report was generated
         | 
| 89 | 
            +
                # @see SessionTracker#get_current_session
         | 
| 90 | 
            +
                # @return [Hash]
         | 
| 37 91 | 
             
                attr_accessor :session
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                # The severity of this report, e.g. 'error', 'warning'
         | 
| 94 | 
            +
                # @return [String]
         | 
| 38 95 | 
             
                attr_accessor :severity
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                # @api private
         | 
| 98 | 
            +
                # @return [Hash]
         | 
| 39 99 | 
             
                attr_accessor :severity_reason
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                # The current user when this report was generated
         | 
| 102 | 
            +
                # @return [Hash]
         | 
| 40 103 | 
             
                attr_accessor :user
         | 
| 41 104 |  | 
| 42 105 | 
             
                ##
         | 
| @@ -66,6 +129,12 @@ module Bugsnag | |
| 66 129 |  | 
| 67 130 | 
             
                ##
         | 
| 68 131 | 
             
                # Add a new metadata tab to this notification.
         | 
| 132 | 
            +
                #
         | 
| 133 | 
            +
                # @param name [String, #to_s] The name of the tab to add
         | 
| 134 | 
            +
                # @param value [Hash, Object] The value to add to the tab. If the tab already
         | 
| 135 | 
            +
                #   exists, this will be merged with the existing values. If a Hash is not
         | 
| 136 | 
            +
                #   given, the value will be placed into the 'custom' tab
         | 
| 137 | 
            +
                # @return [void]
         | 
| 69 138 | 
             
                def add_tab(name, value)
         | 
| 70 139 | 
             
                  return if name.nil?
         | 
| 71 140 |  | 
| @@ -81,6 +150,9 @@ module Bugsnag | |
| 81 150 |  | 
| 82 151 | 
             
                ##
         | 
| 83 152 | 
             
                # Removes a metadata tab from this notification.
         | 
| 153 | 
            +
                #
         | 
| 154 | 
            +
                # @param name [String]
         | 
| 155 | 
            +
                # @return [void]
         | 
| 84 156 | 
             
                def remove_tab(name)
         | 
| 85 157 | 
             
                  return if name.nil?
         | 
| 86 158 |  | 
| @@ -89,6 +161,8 @@ module Bugsnag | |
| 89 161 |  | 
| 90 162 | 
             
                ##
         | 
| 91 163 | 
             
                # Builds and returns the exception payload for this notification.
         | 
| 164 | 
            +
                #
         | 
| 165 | 
            +
                # @return [Hash]
         | 
| 92 166 | 
             
                def as_json
         | 
| 93 167 | 
             
                  # Build the payload's exception event
         | 
| 94 168 | 
             
                  payload_event = {
         | 
| @@ -129,6 +203,8 @@ module Bugsnag | |
| 129 203 |  | 
| 130 204 | 
             
                ##
         | 
| 131 205 | 
             
                # Returns the headers required for the notification.
         | 
| 206 | 
            +
                #
         | 
| 207 | 
            +
                # @return [Hash{String => String}]
         | 
| 132 208 | 
             
                def headers
         | 
| 133 209 | 
             
                  {
         | 
| 134 210 | 
             
                    "Bugsnag-Api-Key" => api_key,
         | 
| @@ -139,18 +215,24 @@ module Bugsnag | |
| 139 215 |  | 
| 140 216 | 
             
                ##
         | 
| 141 217 | 
             
                # Whether this report should be ignored and not sent.
         | 
| 218 | 
            +
                #
         | 
| 219 | 
            +
                # @return [Boolean]
         | 
| 142 220 | 
             
                def ignore?
         | 
| 143 221 | 
             
                  @should_ignore
         | 
| 144 222 | 
             
                end
         | 
| 145 223 |  | 
| 146 224 | 
             
                ##
         | 
| 147 225 | 
             
                # Data set on the configuration to be attached to every error notification.
         | 
| 226 | 
            +
                #
         | 
| 227 | 
            +
                # @return [Hash]
         | 
| 148 228 | 
             
                def request_data
         | 
| 149 229 | 
             
                  configuration.request_data
         | 
| 150 230 | 
             
                end
         | 
| 151 231 |  | 
| 152 232 | 
             
                ##
         | 
| 153 233 | 
             
                # Tells the client this report should not be sent.
         | 
| 234 | 
            +
                #
         | 
| 235 | 
            +
                # @return [void]
         | 
| 154 236 | 
             
                def ignore!
         | 
| 155 237 | 
             
                  @should_ignore = true
         | 
| 156 238 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bugsnag
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 6. | 
| 4 | 
            +
              version: 6.17.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Smith
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-08- | 
| 11 | 
            +
            date: 2020-08-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: concurrent-ruby
         | 
| @@ -33,6 +33,7 @@ extra_rdoc_files: | |
| 33 33 | 
             
            - README.md
         | 
| 34 34 | 
             
            - CHANGELOG.md
         | 
| 35 35 | 
             
            files:
         | 
| 36 | 
            +
            - ".yardopts"
         | 
| 36 37 | 
             
            - CHANGELOG.md
         | 
| 37 38 | 
             
            - LICENSE.txt
         | 
| 38 39 | 
             
            - README.md
         |