Giter Site home page Giter Site logo

exceptional / exceptional Goto Github PK

View Code? Open in Web Editor NEW
116.0 116.0 49.0 962 KB

Exceptional helps you track errors in apps. This Repo contains the Ruby Gem. Exceptional also supports Django, iOS, Javascript, Node-JS, PHP. Each App needs an API key, this is given on signup at

Home Page: http://exceptional.io

License: Other

Ruby 100.00%

exceptional's Introduction

DEPRECATION NOTICE

exceptional.io was officially shutdown on September 1, 2016 in favor of Airbrake.

The exceptional notifier is now officially deprecated.

This repository is no longer accepting pull requests or issues.

The Exceptional team recommends using Airbrake moving forward.

Exceptional helps you track errors in your Ruby apps

This Gem/Plugin posts exception data to Exceptional http://exceptional.io. Data about the request, session, environment and a backtrace of the exception is sent.

Rails 2.x Installation

  1. Install the Gem

    $ gem install exceptional
    
  2. Add config.gem entry to 'config/environment.rb'

    config.gem 'exceptional'
  3. Create your account and app at http://exceptional.io

  4. Configue your API Key

    $ exceptional install <api-key>
    

    using the api-key from the app settings screen within Exceptional

  5. Test with exceptional test

Rails 3 Installation

  1. Add gem entry to Gemfile

    gem 'exceptional'
  2. Run bundle install

  3. Create your account and app at http://exceptional.io

  4. Configue your API Key

    $ exceptional install <api-key>
    

    using the api-key from the app settings screen within Exceptional

  5. Test with exceptional test

Reporting exceptions in development

Exceptional will not report your exceptions in development environment by default.

To enable reporting of exceptions in development, please add the following lines to your exceptional.yml.

development:

  enabled: true

To write Exceptional information to the log or STDOUT instead of sending it to the remote API, add the following line to your exceptional.yml.

development:

  send_to: stdout

This allows you to monitor Exceptional processing in development mode. Valid values for send_to are api (the default), log and stdout.

You can provide custom printers for the log and stdout destinations. For example, if you like using AwesomePrint, you can use something like:

Exceptional::Config.stdout_printer = lambda do |exception_data|
  ap ["@@@ Exceptional error", exception_data]
end

Exceptional::Config.log_printer = lambda do |exception_data|
  Rails.logger.ap ["@@@ Exceptional error", exception_data], :error
end

Multiple Rails environments

To use Exceptional within multiple Rails environments, edit your config/exceptional.yml to look like the following

development:
  enabled: true
  api-key: your-dev-api-key

production:
  enabled: true
  api-key: you-prod-api-key

Development

Use rake spec to run the specs. We use Appraisals for integration tests, so install dependencies with rake appraisal:install. To run integration tests, use rake appraise.

To run all tests use rake.

Exceptional also supports your rack, rake, sinatra and plain ruby apps

For more information check out our docs site http://docs.exceptional.io Or visit our knowledge base http://support.exceptional.io/

Copyright © 2008 - 2012 Exceptional Cloud Services.

exceptional's People

Contributors

andrewo avatar arunagw avatar benarent avatar camdez avatar ciaranlee avatar clifton avatar darragh avatar davidjrice avatar erickreutz avatar gary-rafferty avatar jballanc avatar jjb avatar keo avatar martincik avatar monde avatar nstielau avatar paulca avatar phumpal avatar rmm5t avatar shifi avatar shime avatar stuartchaney avatar technoweenie avatar wal avatar wuputah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exceptional's Issues

Exceptions originating in $APP_ROOT/lib/*.rb ignored

We have a helper class called PaymentGateway that lives in lib/payment_gateway.rb. Exceptions originating from this class do not get sent (or are not reported by) Exceptional.

In our Rails 3.2.6 app (running on REE), our lib/* files are loaded by the autoloader:

config.autoload_paths += [
  Rails.root.join('lib')
]

"exceptional test" fails: undefined method `iso8601'

I've installed exceptional on a rails 2.3.3 app using ree 1.8.7. When I run "exceptional test" a message appears:

...gems/exceptional-2.0.27/lib/exceptional/exception_data.rb:45:in `to_json': You need a json gem/library installed to send errors to Exceptional (Object.to_json not defined).  (StandardError)
Install json_pure, yajl-ruby, json-jruby, or the c-based json gem

However, looking into exceptional.log, the real problem seems to be:

[ERROR] (exception_data.rb:43:in `to_json') Thu Nov 11 09:35:01 UTC 2010 - undefined method `iso8601' for Thu Nov 11 09:35:01 UTC 2010:Time

FIX: Adding require 'time' at the beginning of file exception_data.rb solves the error.

Config not read properly on Heroku

For my staging and productions environments, exceptions would only post to Exceptional if config/exceptional.yml was formatted like this:

api-key: 1234...

or this (where the api key is picked up from the environment variables):

staging:
  enabled: true

production:
  enabled: true

It did NOT worked like this

api-key: <%= ENV['EXCEPTIONAL_API_KEY'] =>

or this:

api-key: '<%= ENV["EXCEPTIONAL_API_KEY"] %>'

or this:

staging:
  enabled: true
  api-key: 1234...

production:
  enabled: true
  api-key: 5678...

I looked at the config.rb and it appears the latter should work, but it did not for me. Just in case someone else has the same issue.

"exceptional test" Fails with "uninitialized constant Class::ConfigurationException"

  1. Installed exceptional gem: "gem install exceptional --version 2.0.11"
  2. Added "gem 'exceptional', '2.0.11'" to Gemfile (using bundler 0.9.12 w/ Rails 2.3.5 on REE 1.8.7)
  3. Ran "exceptional install XXXXXXXXX production"
  4. Ran "exceptional test" or "bundle exec exceptional test"
    /Users/jason/.rvm/gems/ree-1.8.7-2010.01/gems/exceptional-2.0.10/lib/exceptional/config.rb:35:in load': uninitialized constant Class::ConfigurationException (NameError) from /Users/jason/.rvm/gems/ree-1.8.7-2010.01/gems/exceptional-2.0.10/bin/exceptional:27 from /Users/jason/.rvm/gems/ree-1.8.7-2010.01/bin/exceptional:19:inload'
    from /Users/jason/.rvm/gems/ree-1.8.7-2010.01/bin/exceptional:19

DJ integration for older version of DJ?

The DJ integration uses alias_method_chain on Delayed::Job#log_exception — but that method doesn't exist. Maybe it did in a previous version of DJ?

The appropriate thing to work with now would be Delayed::Worker#handle_failed_job, and it would be basically the same code.

Should I submit a patch for this?

Exceptional integration with Sidekiq

I'm trying to receive sidekiq erros in my e-mail, but i was not able to setup properly my Exceptional to achieve that. I didn't found the information on how to do it anywhere, so I hope you could help me to do it.

Exceptional config:

development:
  enabled: true
  send_to: log
beta:
  enabled: true
  send_to: api
  api-key: 'key'
pilot:
  enabled: true
  send_to: api
  api-key: 'key'

Initialization that I use to load the api-key for javascript errors (that are working):

exceptional_config = YAML.load_file(File.join(Rails.root, "config", "exceptional.yml"))[Rails.env]

Encorexp::Application.config.exceptional = exceptional_config

Do I have to do anything else to make Exceptional work on pilot/beta environment with sidekiq?

Regards,

having issues with sending the error to stdout

I am just learning the Exceptional ruby gem and I am having a couple of issues.

The first is that if I set enabled to false the rescue no longer works and my application errors out.

The next issue that I have is even if I set the sent_to option in the config file to stdout it always sends the error out to the api.

The final issue that I am having is that if I try to see what send_to is being set to by calling the Exceptional::Config.send_to I get an error that the method is not defined.

Any help would be appreciated.

Thank you,
Stefanie

My code looks something like this

def foo
    result = {}
    begin
        # do some code here
    rescue Exception => ex
        result = nil
        Exceptional.handle(ex, "Exception")
    end
    return result
end

Gem install fails under JRuby

$ sudo jruby -S gem install exceptional

    Building native extensions.  This could take a while...
    /usr/local/share/jruby-1.2.0/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError)
            from /usr/local/share/jruby-1.2.0/lib/ruby/1.8/mkmf.rb:1:in 'require'
            from extconf.rb:1
    ERROR:  Error installing exceptional:
            ERROR: Failed to build gem native extension.

    /usr/local/share/jruby-1.2.0/bin/jruby extconf.rb


    Gem files will remain installed in /usr/local/share/jruby-1.2.0/lib/ruby/gems/1.8/gems/json-1.2.0 for inspection.
    Results logged to /usr/local/share/jruby-1.2.0/lib/ruby/gems/1.8/gems/json-1.2.0/ext/json/ext/generator/gem_make.out`

documentation

howdy. thanks for a great product and gem, i'm a paying customer.

it seems like your gem has a bunch of nice features that aren't documented anywhere. one is the ability to specify different api keys for different environments in the yml. i discovered this myself and it's very handy.

another is the collection of handy methods: handle, rescue, rescue_and_reraise. Are these documented anywhere? I can pretty much figure out what they do from reading them, but I don't know much about ruby threading so I don't really know what clear! means or if I need to know. Maybe clear! and context should be private?

Able to configure Exceptional library to pass exceptions through in test

Given the following example

class Worker
    def process
        Exceptional.rescue do
            self.do_work
        end
    end

    def do_work
    end
end

describe Worker do
    it "delegates to do work" do
        expect {Worker.new.process}.not_to raise_error
    end
end

If an exception is raised for do_work, this will be swallowed by Exceptional. It should pass the exception through in test otherwise exceptions will be obscured.

App No Longer Sending/Receiving Exceptions

Our app, on our development, staging and production environments, is no longer sending errors to Exceptional.io (and/or exceptional.io is not receiving them).

Our app had been reporting errors to exceptional.io flawlessly for months. With no other gem additions, updates or changes, the app stopped sending errors a few days ago. As best I can tell, our config/exceptional.yml file is fine:

development:
enabled: true
send_to: stdout
api-key: 'mykey'

production:
enabled: true
send_to: api
api-key: 'mykey'

staging:
enabled: true
send_to: api
api-key: 'mykey'

For development, I have tried stdout, log, and api and none work.

Running the exceptional test in the console works in that I receive the following: "Test Exception sent. Please login to http://exceptional.io to see it!".

However, logging into exceptional.io reveals no new errors.

Any advice or direction would be greatly appreciated.

ExceptionData.to_json fails when ActiveRecord::Base subclasses are stored in the session

Multiple popular authentication/authorization frameworks store the user session information with their associated classes. Example:

class User < ActiveRecord::Base
end
class Administrator < User
end

# request.session.to_hash
{ :data => {
  "prefix.user" => [User, 123], # Signed in as User ID:123
  "prefix.administrator" => [Administrator, 456]  # Also, signed in as Administrator ID:456
}}

# request.session.to_hash
# => "Stack Level Too Deep"

Currently, I have the following workaround in place:

class User < ActiveRecord::Base
  def self.to_json(*args)
    name.to_json(*args)
  end
end

But - generally - I think exceptional should be able to handle serialization exceptions.

Make a converter so we can have a drop-in-replacement for hoptoad

we use lots of code that does custom hoptoad stuff, having something like Exceptiona::Converter behave like this interface would make switching as easy as HoptoadNotifier = Exceptiona::Converter, and should boost peoples willingness to switch :)

e.g.

HoptoadNotifier.notify(
  exception,
  :url => queue.to_s,
  :component => component,
  :parameters => {
    :worker => worker,
    :queue => queue,
    :job => payload['class'],
    :args => payload['args'],
    :controller => queue,
    :action => payload['class']
  }
)

no perfect translation needed, but just not loosing these errors would be a good start / save lots of work on our side

SSL cert is not verified

When configure to use SSL, the SSL cert is not verified

         client.verify_mode = OpenSSL::SSL::VERIFY_NONE if config.ssl?

This eliminates half the benefit of using SSL. Would you mind embedding a CA cert into the gem and setting this to VERIFY_PEER?

Thanks,

feature proposal: configuration setting to always raise errors

There is rescue_and_reraise, but what I want is for exceptions that would be reported in production to be raised in development. This happens when Exceptional does automatic catching/reporting in controllers, but not when using Exceptional.handle and Exceptional::Catcher.handle_with_controller. In these cases I'd like my exceptions raised in dev mode.

  1. i'm correct that this doesn't exist in any form yet, right?
  2. would you be open to a patch for such a feature?

thanks!
John

SECURITY: filter_parameters does not partial-match

The Filtering sensitive data KB article states:

Exceptional honours the standard Rails parameter filtering (config.filter_parameters in Rails 3)

However the Exceptional filter fails to filter for partial matches. For example if config.filter_parameters contains secret_details and some POST parameters include user_secret_details, Rails will filter this, but the Exceptional gem will not.

This could be considered a pretty serious security hole, given the assurance in the KB article.

Rails

Rails' ActiionDispatch::FilterParameters uses ActionDispatch::Http::ParameterFilter's case insensitve regular expression to match parameter keys:

# Example:
#
#   env["action_dispatch.parameter_filter"] = [:password]
#   => replaces the value to all keys matching /password/i with "[FILTERED]"
if regexps.find { |r| key =~ r }
  value = '[FILTERED]'

Exceptional

Exceptional::ControllerExceptionData uses Array#include to this effect: keys_to_filter.include?(actual_key) which only matches exact strings:

def key_match?(key, keys_to_filter)
  keys_to_filter.map {|k| k.to_s}.include?(key.to_s)
end

Deprecation warning (session_id)

Gem Version: 2.0.14
Rails Version: 2.3.4

2010-04-15 09:04:16 [ warn] 22320 : DEPRECATION WARNING: ActionController::Session::AbstractStore::SessionHash#session_id has been deprecated. Please use request.session_options[:id] instead.. (called from sanitize_session at /Library/Ruby/Gems/1.8/gems/exceptional-2.0.14/lib/exceptional/controller_exception_data.rb:55)

Allow reporting of custom errors

We currently use hoptoad and would like to switch, but we cannot find a replacement for our current:
HoptoadNotifier.notify(:error_class => 'component xyz failed', :error_message => "user #{user} did something evil")

Which collects the current backtrace (using caller is suppose) and creates a fake exception which is grouped under the error_class and all different error_messages are visible.

Is there something like that / could you add something like that ?

Ignore errors by class

Add the option of ignoring specific errors to the configuration.

Eg.

# in exceptional.yml
ignore: Mongoid::Errors::DocumentNotFound

Exceptional + Heroku breakage

Seeing the following output in my heroku logs / installed via addon + followed instructions in repo. Running latest version.

==> exceptional.log <==
Logfile created on Tue Dec 28 09:39:00 -0800 2010 by logger.rb
INFO Tue Dec 28 17:39:00 UTC 2010 - Loading Exceptional 2.0.32 for 3.0.3
INFO Tue Dec 28 17:39:00 UTC 2010 - Loading Exceptional 2.0.32 for 3.0.3
[INFO](remote.rb:39:in call_remote') Tue Dec 28 17:39:34 UTC 2010 - /api/errors?api_key=7ae8bc5d0e1419c28b748e3c6332d0cb2b7830c3&protocol_version=5&hash=bd357d38af9bdd4d067aefb6f95a3053 - OK [INFO](remote.rb:39:in call_remote') Tue Dec 28 17:39:34 UTC 2010 - /api/errors?api_key=7ae8bc5d0e1419c28b748e3c6332d0cb2b7830c3&protocol_version=5&hash=bd357d38af9bdd4d067aefb6f95a3053 - OK

Bundle Exceptional JS with this gem

Would you be happy for the Exceptional JS error catcher (at http://js.exceptional.io/exceptional.js) to be bundled as part of this gem? It could be added to Rails' asset load path but included in the layout manually.

I'd be interested in this because I want to avoid an external script call slowing down our page load. Can do the work myself and submit a pull request.

Deprecation Warning in Rails 3 (exceptional_tasks.rake)

DEPRECATION WARNING: Rake tasks in /[path]/vendor/plugins/exceptional/tasks/exceptional_tasks.rake are deprecated. Use lib/tasks instead. (called from load_deprecated_tasks at /[path]/.bundle/gems/ruby/1.8/gems/railties-3.0.0.rc/lib/rails/plugin.rb:50)

Any fix on this?

I'm using Heroku, Rails 3 RC1 and Ruby 1.8.7

No information in some exceptions

Hi guys. Ben at Exceptional asked me to create this bug based on this support ticket.

Every now and then, an exception is created in my Exceptional account, but contains no data. Ben said that it might be an issue with BSON::InvalidStringEncoding .

Tests are not running

~/code/geoloqi/exceptional $ rake --trace
rake aborted!
cannot load such file -- spec/rake/spectask
/Users/kyledrake/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/kyledrake/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/kyledrake/Dropbox/code/geoloqi/exceptional/Rakefile:1:in `<top (required)>'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `load'
/Users/kyledrake/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `<main>'
~/code/geoloqi/exceptional $ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.2.0]

Exceptional breaks when preparing the message on Ruby 1.9 (and running Passenger)

As the title says.

The log gives me

# Logfile created on 2009-05-15 14:18:47 +0200 by logger.rb/20321
Handling bad URI(is not URI?): http://no.wikipedia.org/wiki/LÅL
Error preparing exception data.
undefined method `sub' for :@by:Symbol

I fixed this by replacing line 86 of lib/exceptional/api.rb with var = v.to_s.sub("@","") # remove prepended @'s, but haven't really tested too much

Exceptional.handle Raising Exceptions when Disabled

I'm using Exceptional.handle() to notify me of handled exceptions. This works great, until I found a very hard to track down bug in my tests. It turned out the code was running differently in production mode and test mode. The reason is that I had Exceptional disabled in the test environment and enabled in production. To me, as I was basically using Exceptional.handle to log the exception, I was not expecting enabling/disabling it to change the behavior of my app. But it turns out, it breaks my specs because it's re-raising an exception that has already been handled. This change was introduced in ed13144.

If you are setting Exceptional to disabled, it should just be completely disabled and do nothing in my opinion, especially since it causes test and production environments to exhibit different behaviors. Would it be desirable to add an options hash to handle(), to allow for both use cases?

Here is a very simple example that demonstrates the problem:

def process()
  run_process()
rescue => e
  Exceptional.handle(e, "Process failed") # This is raising an exception when exceptional is disabled.
  # Handle exceptional circumstance here...
end

How to use the rescue_with_exceptional method to handle exceptions from controllers

While browsing the source code for a better way to handle calls to Exceptional from a Rails controller, I found this module : https://github.com/exceptional/exceptional/blob/master/lib/exceptional/integration/rails.rb

It adds a method named rescue_with_exceptional to ActionController::Base to report an exception from a controller. This is far better than the suggested Exceptional.handle since we get a lot more context regarding the request. But then this seems completely undocumented and it's not event imported on the plugin initialization.

So is this production ready? How can it be used to handle exceptions from controllers ?

Passwords are not filtered by default outside of Rails

When using the Exceptional rack middleware, there is no mechanism for default filtering of passwords. Business logic concerns aside, the convention I've seen is to enable password filtering by default by scrubbing all parameters sent in the "extra info" call, so that if a hash key matches a case insensitive regex of "password", it replaces with something like [FILTERED]. You can see how this was implemented with Toadhopper: https://github.com/toolmantim/toadhopper/blob/master/lib/toadhopper.rb#L196

I don't recall if Toadhopper does it by default (it should IMHO), but I've implemented it as such within a Sinatra application:

set :airbrake,        :api_key => 'KEY', :filters => /password/i

It would be nice to at least have a mechanism for doing it similar to the above example.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.