Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: expected HTTP codes / error classes / error messages shouldn't impact Apdex #2619

Merged
merged 9 commits into from
May 3, 2024

Conversation

fallwith
Copy link
Contributor

@fallwith fallwith commented May 2, 2024

If an error is either expected (which still creates an entry in the Errors Inbox) or ignored (which does not), the transaction's Apdex should not factor in the error.

A bug was discovered involving errors that were expected by way of their HTTP response codes that would cause those errors to impact Apdex. Errors that were expected via the agent's Noticed Errors API would correctly not impact Apdex, but HTTP response code based expected errors would incorrectly do so.

Now ignored errors and both kinds of expected errors will correctly not impact Apdex when observed during a transaction.

UPDATE: NOTE: the key change introduced here is that we no longer simply check a New Relic error object for an expected: true attribute value, but that we also perform an ErrorCollector#expected? check. The attribute value can only be set by invoking the notice_error API, but the #expected? check will examine other things including the HTTP status code (if present), the customer defined expected error class list, and the customer defined expected error message list. So now all ways of configuring the agent to expect an error should result in any matching errors no longer having any impact on Apdex.

resolves #2594

If an error is either expected (which still creates an entry in the
Errors Inbox) or ignored (which does not), the transaction's Apdex
should not factor in the error.

A bug was discovered involving errors that were expected by way of
their HTTP response codes that would cause those errors to impact Apdex.
Errors that were expected via the agent's Noticed Errors API would
correctly not impact Apdex, but HTTP response code based expected errors
would incorrectly do so.

Now ignored errors and both kinds of expected errors will correctly not
impact Apdex when observed during a transaction.

resolves #2594
changelog entry for the HTTP status code expected errors Apdex impact
bugfix
@@ -228,7 +228,9 @@ def assert_metrics_recorded(expected)
expected.each do |specish, expected_attrs|
expected_spec = metric_spec_from_specish(specish)
actual_stats = NewRelic::Agent.instance.stats_engine.to_h[expected_spec]
if !actual_stats
if actual_stats
assert(actual_stats)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously if assert_metrics_recorded was called to simply check that the metric itself was recorded and no expected attributes were specified, no Minitest assertions would actually be performed. Now an assert will be called.

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
These lines were supposed to be removed as part of acb8297
@fallwith fallwith changed the title bugfix: expected HTTP codes don't impact Apdex bugfix: expected HTTP codes / error classes / error messages shouldn't impact Apdex May 2, 2024
Copy link

github-actions bot commented May 2, 2024

SimpleCov Report

Coverage Threshold
Line 93.76% 93%
Branch 71.49% 71%

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
lib/new_relic/agent/error_collector.rb Outdated Show resolved Hide resolved
test/new_relic/agent/transaction_test.rb Show resolved Hide resolved
lib/new_relic/agent/transaction.rb Show resolved Hide resolved
fallwith and others added 4 commits May 2, 2024 10:37
"corresponding"

Co-authored-by: Kayla Reopelle (she/her) <87386821+kaylareopelle@users.noreply.github.com>
Improve formatting of the expected errors Apdex impact bugfix entry

Co-authored-by: Kayla Reopelle (she/her) <87386821+kaylareopelle@users.noreply.github.com>
Improve the expected errors Apdex impact bugfix entry's description

Co-authored-by: Kayla Reopelle (she/her) <87386821+kaylareopelle@users.noreply.github.com>
"user defined" -> "user-defined"

Co-authored-by: Kayla Reopelle (she/her) <87386821+kaylareopelle@users.noreply.github.com>
CHANGELOG.md Outdated Show resolved Hide resolved
Improve scope in expected error apdex bugfix entry

Co-authored-by: Tanna McClure <tmcclure@newrelic.com>
@fallwith fallwith merged commit abd132d into dev May 3, 2024
30 checks passed
@fallwith fallwith deleted the expectional branch May 3, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Errors that are expected by way of expected_status_codes should not impact Apdex
4 participants