Skip to content

404s are always treated as errors in Symfony integration #423

Open
@ostrolucky

Description

@ostrolucky

Even though application itself doesn't consider route not found issues as errors, newrelic-php-agent forcefully marks such transactions as errors

Description

See these errors
image

These are not really errors from application POV. See, Symfony catches it in HttpKernel::handle, then response is just replaced in that case and exception not further rethrown at HttpKernel::handleThrowable.

This is confirmed when we set newrelic.framework=no_framework in .ini configuration. With no_framework value, 404s are no longer treated as errors, despite other errors still being reported as normal, thanks to ekino newrelic bundle.

Steps to Reproduce

Set up symfony application with NR agent installed and call URL which reaches the application, but route doesn't exist.

Expected Behavior

Easiest solution would be to check if exception is instance of \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface and in that case don't mark transaction as error.

Relevant Logs / Console output

Your Environment

php > var_dump(phpversion('newrelic'));
string(10) "9.19.0.309"
php > var_dump(PHP_VERSION);
string(5) "8.1.3"
php >

Additional context

In case you have super rights, you can probably view example error from screenshot here https://onenr.io/0oR80733PRG

Metadata

Metadata

Assignees

No one assigned

    Labels

    PMPM to review against project priorities.documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions