Skip to content

Commit

Permalink
expected errors and apdex: description updates
Browse files Browse the repository at this point in the history
update the changelog and source comments to explain that by looping in
`ErrorCollector#expected?` (which calls `ErrorFilter#expected?`), we're
actually fixing broken expected-errors-should-not-impact-apdex behavior
for all 3 "expected" configuration parameter lists: HTTP status codes,
classes, and errors
  • Loading branch information
fallwith committed May 2, 2024
1 parent c661b1b commit acb8297
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

Version <dev> fixes a bug that would cause an error and a correspondong expected HTTP status code to negatively impact a transaction's Apdex.

- **Bugfix: Expected HTTP status code based errors won't impact Apdex
- **Bugfix: Expected HTTP status code / error class / error message based errors won't impact Apdex

The agent is supposed to prevent observed application errors from negatively impacting Apdex if the errors are to be either ignored or expected. There are 2 ways for the agent to expect an error: via the `notice_error` API receiving an `expected: true` argument or via a matches made against the configuration file based user defined lists for expected HTTP status codes (`:'error_collector.expected_status_codes'`), expected error classes (`:'error_collector.expected_classes'`), or expected error messages (`:'error_collector.expected_messages'`). Previously only errors expected via the `notice_error` API were correctly prevented from impacting Apdex and the configuration parameter based expected errors were incorrectly impacting Apdex. This behavior has been fixed and now both types of expected errors will correctly not impact Apdex. Thanks very much to [@florianpilz](https://github.com/florianpilz) for bringing this issue to our attention. [PR#2619](https://github.com/newrelic/newrelic-ruby-agent/pull/2619)

The agent is supposed to prevent observed application errors from negatively impacting Apdex if the errors are to be either ignored or expected. There are 2 ways for the agent to expect an error: via the `notice_error` API and via the `:'error_collector.expected_status_codes'` configuration parameter. Previously only errors expected via the `notice_error` API were correctly prevented from impacting Apdex and the configuration parameter based expected errors were incorrectly impacting Apdex. This behavior has been fixed and now both types of expected errors will correctly not impact Apdex.

## v9.9.0

Expand Down
11 changes: 11 additions & 0 deletions lib/new_relic/agent/error_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ def error_is_ignored?(error, status_code = nil)
end

# Neither ignored nor expected errors impact apdex.
#
# Ignored errors are checked via `#error_is_ignored?`
# Expected errors are checked in 2 separate ways:
# 1. The presence of an `expected: true` attribute key/value pair in the
# options hash, which will be set if that key/value pair was used in
# the `notice_error` public API.
# 2. By calling `#expected?` which in turn calls `ErrorFilter#expected?`
# which checks for 3 things:
# - A match for user defined HTTP status codes to expect
# - A match for user defined error classes to expect
# - A match for user defined error messages to expect
# Errors can be expected either at notice time or via
# :'error_collector.exepcted_status_codes'.
def error_affects_apdex?(error, options)
Expand Down

0 comments on commit acb8297

Please sign in to comment.