Skip to content

Commit

Permalink
Send fingerprint to distinguish errors
Browse files Browse the repository at this point in the history
Sentry respects this, but we've not provided it.
  • Loading branch information
landongrindheim committed Mar 12, 2024
1 parent 372abcc commit f15137f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions common/lib/dependabot/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module ErrorAttributes
BACKTRACE = "error-backtrace"
CLASS = "error-class"
DETAILS = "error-details"
FINGERPRINT = "fingerprint"
MESSAGE = "error-message"
DEPENDENCIES = "job-dependencies"
DEPENDENCY_GROUPS = "job-dependency-groups"
Expand Down
1 change: 1 addition & 0 deletions updater/lib/dependabot/base_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def handle_unknown_error(err)
ErrorAttributes::CLASS => err.class.to_s,
ErrorAttributes::MESSAGE => err.message,
ErrorAttributes::BACKTRACE => err.backtrace.join("\n"),
ErrorAttributes::FINGERPRINT => err.sentry_context[:fingerprint] if err.respond_to?(:sentry_context),
ErrorAttributes::PACKAGE_MANAGER => job.package_manager,
ErrorAttributes::JOB_ID => job.id,
ErrorAttributes::DEPENDENCIES => job.dependencies,
Expand Down
1 change: 1 addition & 0 deletions updater/lib/dependabot/file_fetcher_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def handle_file_fetcher_error(error)
ErrorAttributes::CLASS => error.class.to_s,
ErrorAttributes::MESSAGE => error.message,
ErrorAttributes::BACKTRACE => error.backtrace.join("\n"),
ErrorAttributes::FINGERPRINT => error.sentry_context[:fingerprint] if error.respond_to?(:sentry_context),
ErrorAttributes::PACKAGE_MANAGER => job.package_manager,
ErrorAttributes::JOB_ID => job.id,
ErrorAttributes::DEPENDENCIES => job.dependencies,
Expand Down
1 change: 1 addition & 0 deletions updater/lib/dependabot/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def capture_exception(error:, job: nil, dependency: nil, dependency_group: nil,
ErrorAttributes::CLASS => error.class.to_s,
ErrorAttributes::MESSAGE => error.message,
ErrorAttributes::BACKTRACE => error.backtrace&.join("\n"),
ErrorAttributes::FINGERPRINT => error.sentry_context[:fingerprint] if error.respond_to?(:sentry_context),
ErrorAttributes::PACKAGE_MANAGER => job&.package_manager,
ErrorAttributes::JOB_ID => job&.id,
ErrorAttributes::DEPENDENCIES => dependency&.name || job&.dependencies,
Expand Down
1 change: 1 addition & 0 deletions updater/lib/dependabot/update_files_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def handle_parser_error(error)
ErrorAttributes::CLASS => error.class.to_s,
ErrorAttributes::MESSAGE => error.message,
ErrorAttributes::BACKTRACE => error.backtrace.join("\n"),
ErrorAttributes::FINGERPRINT => error.sentry_context[:fingerprint] if error.respond_to?(:sentry_context),
ErrorAttributes::PACKAGE_MANAGER => job.package_manager,
ErrorAttributes::JOB_ID => job.id,
ErrorAttributes::DEPENDENCIES => job.dependencies,
Expand Down
1 change: 1 addition & 0 deletions updater/lib/dependabot/updater/error_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def log_unknown_error_with_backtrace(error)
ErrorAttributes::CLASS => error.class.to_s,
ErrorAttributes::MESSAGE => error.message,
ErrorAttributes::BACKTRACE => error.backtrace.join("\n"),
ErrorAttributes::FINGERPRINT => error.sentry_context[:fingerprint] if error.respond_to?(:sentry_context),
ErrorAttributes::PACKAGE_MANAGER => job.package_manager,
ErrorAttributes::JOB_ID => job.id,
ErrorAttributes::DEPENDENCIES => job.dependencies,
Expand Down
1 change: 1 addition & 0 deletions updater/spec/dependabot/updater/error_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
Dependabot::ErrorAttributes::BACKTRACE => "bees.rb:5:in `buzz`",
Dependabot::ErrorAttributes::MESSAGE => "There are bees everywhere",
Dependabot::ErrorAttributes::CLASS => "StandardError",
Dependabot::ErrorAttributes::FINGERPRINT => anything,
Dependabot::ErrorAttributes::PACKAGE_MANAGER => "bundler",
Dependabot::ErrorAttributes::JOB_ID => "123123",
Dependabot::ErrorAttributes::DEPENDENCIES => [],
Expand Down
1 change: 1 addition & 0 deletions updater/spec/dependabot/updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,7 @@ def expect_update_checker_with_ignored_versions(versions, dependency_matcher: an
Dependabot::ErrorAttributes::BACKTRACE => an_instance_of(String),
Dependabot::ErrorAttributes::MESSAGE => "Potentially sensitive log content goes here",
Dependabot::ErrorAttributes::CLASS => "Dependabot::SharedHelpers::HelperSubprocessFailed",
Dependabot::ErrorAttributes::FINGERPRINT => anything,
Dependabot::ErrorAttributes::PACKAGE_MANAGER => "bundler",
Dependabot::ErrorAttributes::JOB_ID => "1",
Dependabot::ErrorAttributes::DEPENDENCY_GROUPS => []
Expand Down

0 comments on commit f15137f

Please sign in to comment.