bugsnag / bugsnag-ruby

BugSnag error monitoring & reporting software for rails, sinatra, rack and ruby
https://docs.bugsnag.com/platforms/ruby
MIT License
248 stars 173 forks source link

Add `Configuration#vendor_paths` to replace `Configuration#vendor_path` #705

Closed imjoehaines closed 3 years ago

imjoehaines commented 3 years ago

Goal

This PR adds Configuration#vendor_paths to replace Configuration#vendor_path

vendor_paths is an array of strings which will mark a stack frame as out of project if the frame's file path starts with any of the strings, after removing the project root (if a file is outside of the project root, it wouldn't be marked as in project in the first place)

For example, with this stacktrace:

[
  "/foo/bar/app/models/user.rb:1:in `something'",
  "/foo/bar/abc/lib/ignore_me.rb:1:in `to_s'",
  "/foo/bar/xyz/lib/ignore_me.rb:1:in `to_s'",
]

and this configuration:

Bugsnag.configure do |config|
  config.project_root = "/foo/bar"
  config.vendor_paths = ["abc", "xyz"]
end

only /foo/bar/app/models/user.rb will be marked as in project, as the other paths are matched by vendor_paths

Note that matches are done on entire directories, for example abc does not match abc_xyz