JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

How to prevent jsonapi-resources from logging backtraces.

Open
#798 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted Type: Enhancement
Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

Both here and here jsonapi-resources logs the complete backtrace of exceptions. We are using structured logging and don't want to have these backtraces in our logs. We are sending them to an error catcher service (like Airbrake or Honeybadger).

During a production incident with a lot of errors these backtraces flooded everything. It would be nice to completely replace the logging with a custom implementation.

Along the same lines it, it would be convenient to define that error handling in a single place. Currently you need to overwrite both handle_exceptions and an on_server_error callback. See #780

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading lib/jsonapi/acts_as_resource_controller.rb around handle_exceptions and lib/jsonapi/operation_dispatcher.rb around on_server_error, then review the related discussion in #780. Trace how exceptions are logged in both paths and determine the expected single customization point; done means applications can control error logging without unwanted backtraces in structured logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.