Platinum Partner
news,cloud,heroku

Collecting Heroku Exception Stack Traces

On the Heroku platform, all error messages dumped on the console are acquired and logged line-by-line. While this is simple and straightforward, it has one unfortunate result – events that are spread on multiple lines appears as multiple events.

This can be especially annoying for dumped exception stack traces. Typically, stack trace looks like this (note the interleaving router event):

215 1 2012-04-08T10:02:33+00:00 d. app web.2 - - /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_tcp_server': no acceptor (RuntimeError)
189 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_server'
185 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/backends/tcp_server.rb:16:in `connect'
186 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/backends/base.rb:53:in `block in start'
181 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
188 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
180 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
176 1 2012-04-08T10:02:33+00:00 d. heroku router - - HEAD ex.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=4ms status=301 bytes=0
177 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/thrap-1.3.1/lib/thrap/backends/base.rb:61:in `start'
171 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/thrap-1.3.1/lib/thrap/server.rb:159:in `start'
186 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/thrap-1.3.1/lib/thrap/controllers/controller.rb:86:in `start'
177 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/thrap-1.3.1/lib/thrap/runner.rb:185:in `run_command'
170 1 2012-04-08T10:02:33+00:00 d. app web.2 - - from /app/vendor/bundle/ruby/1.9.1/gems/thrap-1.3.1/lib/thrap/runner.rb:151:in `run!'

We are happy to announce that we extended our indexers to automatically identify and collect stack traces as a single event. All real-life obstacles are taken into account. That means any events injected into the stack trace are correctly placed after the event. Even multiple interleaving stack traces are properly handled!

210 1 2012-05-23T15:53:59+00:00 d. app web.1 - - /app/config/environment.rb:3:in `': undefined local variable or method `fdsfdsf' for main:Object (NameError)
    from :29:in `require'
    from config.ru:3:in `block (3 levels) in '
    from /home/heroku_rack/heroku.ru:23:in `eval'
    from /home/heroku_rack/heroku.ru:23:in `block (3 levels) in '
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:46:in `instance_eval'
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:46:in `initialize'
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:63:in `new'
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:63:in `map'
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:46:in `instance_eval'
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:46:in `initialize'
    from /home/heroku_rack/heroku.ru:11:in `new'
    from /home/heroku_rack/heroku.ru:11:in `block in '
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:46:in `instance_eval'
    from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/builder.rb:46:in `initialize'
    from /home/heroku_rack/heroku.ru:1:in `new'
    from /home/heroku_rack/heroku.ru:1:in `'

The engine recognizes stack traces for Ruby, Python, and Java. Due to large amount of variances, let us know if it is not recognizing your variant. We are happy to implement that for you.

 

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}