opbeat / opbeat-ruby Goto Github PK
View Code? Open in Web Editor NEWExperimental opbeat module for Ruby
License: BSD 3-Clause "New" or "Revised" License
Experimental opbeat module for Ruby
License: BSD 3-Clause "New" or "Revised" License
I note that this 3.0.11 is the current version, and it is on RubyGems.org, but eh, no Git tag.
The stack traces show in opbeat in the 'wrong direction' with the least useful frames on top, and you have to expand the trace to show the frame that actually threw the exception.
I see this in my production log after upgrading to opbeat 3.0.8 (Rails 5)
I'll take a closer look asap, but wanted to file the issue here fast as well so others can chip in ;-)
Aug 26 09:05:06 myphoner app/web.2: F, [2016-08-26T07:05:06.483114 #134] FATAL -- : vendor/bundle/ruby/2.3.0/gems/opbeat-3.0.8/lib/opbeat/middleware.rb:10:in `call'
Aug 26 09:26:19 myphoner app/web.2: E, [2016-08-26T07:26:19.663950 #134] ERROR -- : ** [Opbeat] Error capturing or sending exception undefined method `split' for nil:NilClass
Sometimes traces end up like this, where the HTTP traffic looks like it starts before the actual trace.
The Sidekiq integration bits get loaded, no matter what. This interferes with custom Sidekiq middleware and error handlers that report errors to Opbeat, typically causing duplicates to appear in Opbeat.
It should be possible to disable the Sidekiq integration feature.
Working on upgrading an app from v2.0 to v3. One thing outstanding:
I have a few calls to Opbeat.capture_exception
(and capture_message
, but that's less important) scattered throughout my app. Is there any corollary to this in version 3?
Example:
begin
abc
rescue Exception => e
Opbeat.capture_exception(e)
end
If you send emails inline they take up a big chunk of the request transaction but they aren't traced.
I’m using your Opbeat-Ruby gem for my application, but I realized that there are some parameters which I use in my application is sent over to Opbeat, even though I have set those parameters to be filtered in filter_parameters
. Here’s a snippet of of my code:
Rails.application.configure do
config.opbeat = {
organization_id: ENV['OPBEAT_ORG_ID'] ,
app_id: ENV['OPBEAT_APP_ID'] ,
secret_token: ENV['OPBEAT_SECRET_TOKEN'],
filter_parameters: [ :password, :password_confirmation, :current_password, :token, :secret, :_secret2 ]
}
:_secret2
is still being logged inside Opbeat.
Is there an upgrade guide from v2 of the gem?
I’m using
Opbeat.set_context
which doesn’t exist anymore.
I tried adding the code from your docs:
Rails.application.configure do |config|
# ...
config.opbeat.organization_id = 'XXX'
config.opbeat.app_id = 'XXX'
config.opbeat.secret_token = 'XXX'
end
but it fails:
➜ Simplero git:(master) ✗ rc
/Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/railties/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `opbeat' for #<Rails::Application::Configuration:0x007ff65f451548> (NoMethodError)
from /Users/calvin/Simplero/config/environments/development.rb:105:in `block in <top (required)>'
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/railties/lib/rails/railtie.rb:210:in `instance_eval'
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/railties/lib/rails/railtie.rb:210:in `configure'
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/railties/lib/rails/railtie.rb:182:in `configure'
I tried without the Rails.application.configure first, and it still fails:
➜ Simplero git:(master) ✗ rc
/Users/calvin/Simplero/config/initializers/opbeat.rb:6:in `block in <top (required)>': undefined method `opbeat' for #<Simplero::Application:0x007fe2cb2262e8> (NoMethodError)
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/railties/lib/rails/railtie.rb:210:in `instance_eval'
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/railties/lib/rails/railtie.rb:210:in `configure'
from /Users/calvin/Simplero/config/initializers/opbeat.rb:5:in `<top (required)>'
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/activesupport/lib/active_support/dependencies.rb:268:in `load'
I tried in a config/initializers/opbeat.rb, and it still fails:
➜ Simplero git:(master) ✗ rc
/Users/calvin/Simplero/config/initializers/opbeat.rb:6:in `block in <top (required)>': undefined method `opbeat' for #<Opbeat::Configuration:0x007f89cf5b45b8> (NoMethodError)
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/opbeat-3.0.3/lib/opbeat/configuration.rb:62:in `initialize'
from /Users/calvin/Simplero/config/initializers/opbeat.rb:5:in `new'
from /Users/calvin/Simplero/config/initializers/opbeat.rb:5:in `<top (required)>'
from /Users/calvin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/rails-e90c76b83397/activesupport/lib/active_support/dependencies.rb:268:in `load'
So far, it’s not easy at all, and I can’t find anything that says what I need to change.
Can you point me in the right direction?
As of now, the only way to filter exceptions is the excluded_exceptions
array.
I have the error with class ActionController::RoutingError
which happens a lot, especially when some bots are scanning my app, and while I don't want to be spamed all the day long, I don't want to ignore ALL of the ActionController::RoutingError
exceptions.
Having a before hook, juste before the excluded_exceptions
array, passing the exception as a parameter would allow us to check some details about the exception, like in my case the message content using a Regex, a filter the exception with a finer granularity.
Something like:
config.opbeat.before_sending do |exception|
if exception.message ~= /my message/
return false # Prevent sending the exception
end
end
Hi there, me again.
As part of the upgrade process, I noticed that my "mounted apps" using Sinatra are now broken.
A common example would be Sidekiq::Web (a web interface for your sidekiq queue).
It is mounted in the routes file like:
require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'
And the error that you get when visiting that page is:
NoMethodError at /sidekiq/
undefined method `endpoint=' for nil:NilClass
file: sinatra.rb location: block in dispatch! line: 13
Here's the backtrace if it helps:
I assume the problem is that I'm only using the Rails initialization steps, but I'll also need to somehow include the Rack steps for these mounted Rack apps.
Any idea on how that can be done?
After upgrading to rails 5 I see this in my logs:
** [Opbeat] Error capturing or sending exception undefined method `each' for #<ActionDispatch::Request:0x007fc96be63840>
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/opbeat-ruby-6b1705474436/lib/opbeat/error_message/http.rb:29:in `from_rack_env'
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/opbeat-ruby-6b1705474436/lib/opbeat/error_message.rb:64:in `from_exception'
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/opbeat-ruby-6b1705474436/lib/opbeat/client.rb:196:in `report'
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/opbeat-ruby-6b1705474436/lib/opbeat.rb:114:in `report'
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/opbeat-ruby-6b1705474436/lib/opbeat/integration/rails/inject_exceptions_catcher.rb:12:in `render_exception_with_opbeat'
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `rescue in call'
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:48:in `call'
Is the gem compatible with rails 5 or is it some other issue? I noticed that the builds haven't passed since 3.0.3 - I've reproduced this error with both 3.0.3, 3.0.7 and the fork with Rails 5 compatibility (#27)
Any ideas?
The fix for with_context
is mega-useful, thanks for having it in master. It's worth a release, I think!
Hi,
I get this:
2016-02-01T14:23:03.607Z 7211 TID-ovlsyrz9g ERROR: !!! ERROR HANDLER THREW AN ERROR !!! 2016-02-01T14:23:03.609Z 7211 TID-ovlsyrz9g ERROR: wrong number of arguments (2 for 1) 2016-02-01T14:23:03.610Z 7211 TID-ovlsyrz9g ERROR: /home/jnylen/.gem/ruby/2.2.4/bundler/gems/opbeat-ruby-7df5c6c1130e/lib/opbeat/integration/sidekiq.rb:33:in 'block (2 levels) in <top (required)>' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/exception_handler.rb:20:in 'call' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/exception_handler.rb:20:in 'block in handle_exception' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/exception_handler.rb:18:in 'each' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/exception_handler.rb:18:in 'handle_exception' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/processor.rb:142:in 'rescue in process' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/processor.rb:146:in 'process' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/processor.rb:79:in 'process_one' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/processor.rb:67:in 'run' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/util.rb:16:in 'watchdog' /home/jnylen/.gem/ruby/2.2.4/gems/sidekiq-4.0.2/lib/sidekiq/util.rb:24:in 'block in safe_thread'
When a ActiveRecord NotFound error occur.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.