Skip to content

Add a way to specify where the max backtrace frames are truncated #3011

Open
@thestelz

Description

Is your feature request related to a problem? Please describe.

Per the docs on error_collector.max_backtrace_frames:

[...] backtraces over this amount are truncated in the middle [...]

In my experience, backtraces for rails have the most info for specifics at the begging and middle and not towards the end (that is usually rails callers and the such). This means I typically have to increase the size of the backtrace from the default 50 to something like 100 or 200 to make sure I'm getting the "guts" of the error message.

Feature Description

I would like to request a setting that will allow us to set where the backtrace frames are truncated.

Something like: error_collector.max_backtrace_frames_truncate_location or error_collector.backtrace_truncate_location (or something along those lines) with a default of middle (to keep current behavior) and the options of top/start, middle, and end.

Then if someone were to put end as an option, the ending lines of the stack trace would be removed instead of the middle.

Describe Alternatives

The only alternative I can think of is to add a larger amount to the stack tract to get more details.

ending stack trace to an old system

These ending lines don't really add much to the stack trace to track down the bug/error.

…5.3/gems/actionpack-5.2.6/lib/abstract_controller/base.rb:194:in `process_action'
…actionpack-5.2.6/lib/action_controller/metal/rendering.rb:30:in `process_action'
…ems/actionpack-5.2.6/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
…/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:132:in `run_callbacks'
…ems/actionpack-5.2.6/lib/abstract_controller/callbacks.rb:41:in `process_action'
…ms/actionpack-5.2.6/lib/action_controller/metal/rescue.rb:22:in `process_action'
…pack-5.2.6/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
…s/activesupport-5.2.6/lib/active_support/notifications.rb:168:in `block in instrument'
…rt-5.2.6/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
…s/activesupport-5.2.6/lib/active_support/notifications.rb:168:in `instrument'
…pack-5.2.6/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
…npack-5.2.6/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
…rd-5.2.6/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
…5.3/gems/actionpack-5.2.6/lib/abstract_controller/base.rb:134:in `process'
…-2.5.3/gems/actionview-5.2.6/lib/action_view/rendering.rb:32:in `process'
….5.3/gems/actionpack-5.2.6/lib/action_controller/metal.rb:191:in `dispatch'
….5.3/gems/actionpack-5.2.6/lib/action_controller/metal.rb:252:in `dispatch'
…actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
…actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:34:in `serve'
…ms/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:52:in `block in serve'
…ms/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:35:in `each'
…ms/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:35:in `serve'
…actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:840:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…relic_rpm-9.10.1/lib/new_relic/rack/browser_monitoring.rb:38:in `traced_call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…rvm/gems/ruby-2.5.3/gems/rack-cors-1.0.2/lib/rack/cors.rb:97:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ms/ruby-2.5.3/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ntu/.rvm/gems/ruby-2.5.3/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ms/ruby-2.5.3/gems/rack-2.2.3/lib/rack/conditional_get.rb:40:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ntu/.rvm/gems/ruby-2.5.3/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…5.2.6/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…uby-2.5.3/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
…uby-2.5.3/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ctionpack-5.2.6/lib/action_dispatch/middleware/cookies.rb:670:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ionpack-5.2.6/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
…/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:98:in `run_callbacks'
…ionpack-5.2.6/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…-5.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…k-5.2.6/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…s/ruby-2.5.3/gems/railties-5.2.6/lib/rails/rack/logger.rb:38:in `call_app'
…s/ruby-2.5.3/gems/railties-5.2.6/lib/rails/rack/logger.rb:26:in `block in call'
…/activesupport-5.2.6/lib/active_support/tagged_logging.rb:71:in `block in tagged'
…/activesupport-5.2.6/lib/active_support/tagged_logging.rb:28:in `tagged'
…/activesupport-5.2.6/lib/active_support/tagged_logging.rb:71:in `tagged'
…s/ruby-2.5.3/gems/railties-5.2.6/lib/rails/rack/logger.rb:26:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ionpack-5.2.6/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…onpack-5.2.6/lib/action_dispatch/middleware/request_id.rb:27:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…ms/ruby-2.5.3/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…/.rvm/gems/ruby-2.5.3/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…b/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…tionpack-5.2.6/lib/action_dispatch/middleware/executor.rb:14:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
….rvm/gems/ruby-2.5.3/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…m/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/engine.rb:524:in `call'
…/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/railtie.rb:190:in `public_send'
…/gems/ruby-2.5.3/gems/railties-5.2.6/lib/rails/railtie.rb:190:in `method_missing'
…lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
…/ruby-2.5.3/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:606:in `process_client'
…/ruby-2.5.3/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:701:in `worker_loop'
…/ruby-2.5.3/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:549:in `spawn_missing_workers'
…/ruby-2.5.3/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:142:in `start'
….rvm/gems/ruby-2.5.3/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top(required)>'
       /home/ubuntu/.rvm/gems/ruby-2.5.3/bin/unicorn_rails:23:in `load'
       /home/ubuntu/.rvm/gems/ruby-2.5.3/bin/unicorn_rails:23:in `<main>'

Additional context

This might be helpful to others (not sure?), but I feel like I would utilize it. Maybe I'm missing a configuration setting or didn't know about a setting that would work instead of adding this feature to save everyone time.

Priority

Nice to Have

Metadata

Assignees

No one assigned

    Labels

    communityTo tag external issues and PRs submitted by the communityfeature requestTo tag feature request after Hero Triage for PM to dispositionneeds review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions