newrelic-dotnet-agent icon indicating copy to clipboard operation
newrelic-dotnet-agent copied to clipboard

Feature request: New API IgnoreError

Open tiagodaraujo opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

I cannot configure NewRelic, via configuration files, to exclude certain transactions from the error rate. Sometimes the HTTP code, class, or exception is not enough, because I want to include more parameters from the request to decide if it is an expected error. Otherwise, these errors will affect the error rate and, consequently the alerts.

Feature Description

Create a new API method to exclude the error rate transaction as it exists for Apdex NewRelic.IgnoreApdex, but do not exclude the Transaction event. e.g. NewRelic.IgnoreError()

Describe Alternatives

Create a custom attribute request.error.expected and custom queries for alerts and dashboard.

Additional context

N/A.

Priority

Must Have

tiagodaraujo avatar Apr 12 '22 07:04 tiagodaraujo

Hi @tiagodaraujo, thank you for your feature request.

To clarify a few things:

  1. It seems like what you're looking for is an API method to mark specific errors in your application as "expected", i.e. the error would still be sent to New Relic, but would not affect your application's Apdex. (See this doc on the difference between ignoring and expecting errors: https://docs.newrelic.com/docs/apm/agents/manage-apm-agents/agent-data/manage-errors-apm-collect-ignore-or-mark-expected/) Please confirm if "expecting" the error is what you're looking for.
  2. How would do you see this being used in your application code? Would it apply to all errors generated within that method? The most recently generated error? All errors within the current transaction context? Would it take any arguments?

If you could provide a code mockup of how you see the API being used and what the expected effect would be, that would be ideal.

nr-ahemsath avatar Apr 15 '22 18:04 nr-ahemsath

Hi @tiagodaraujo, could you advise on the questions above? We would like to move this feature request along but will need your feedback. Thanks for understanding!

angelatan2 avatar Apr 25 '22 18:04 angelatan2

Hi @nr-ahemsath and @angelatan2

Apologies for the delay, I've been away for a few days and haven't been able to respond at all.

@nr-ahemsath

  1. Yes "expecting" what I'm looking for (here). It is exactly the same behaviour as the existing configuration (net-agent-configuration) but above of application configuration (web.config, app.config , appsettings.json) there would be a precedence of an API method that could ignore that HttpError. That is, we could find that transaction with an Http code 404, however it would not affect the error rate or apdex, exactly the same way if we had an <ignoreStatusCodes>404...
  2. I see calling a NewRelic.IgnoreApdex() method in my controller when I want to send a 404 response under certain conditions in my application. pseudo code: If (HttpContext.Origin Is Unknown) Then NewRelic.IgnoreErrorRate() And NewRelic.IgnoreApdex().

image

Thanks in advance

tiagodaraujo avatar May 06 '22 16:05 tiagodaraujo

https://issues.newrelic.com/browse/NEWRELIC-3680

Work has been completed on this issue.