Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Collecting Heroku Exception Stack Traces

DZone's Guide to

Collecting Heroku Exception Stack Traces

· Cloud Zone
Free Resource

Download the Essential Cloud Buyer’s Guide to learn important factors to consider before selecting a provider as well as buying criteria to help you make the best decision for your infrastructure needs, brought to you in partnership with Internap.

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.

 

The Cloud Zone is brought to you in partnership with Internap. Read Bare-Metal Cloud 101 to learn about bare-metal cloud and how it has emerged as a way to complement virtualized services.

Topics:

Published at DZone with permission of Trevor Parsons, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}