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

[10.x] Add Method to Report only logged exceptions #47554

Merged
merged 4 commits into from
Jun 26, 2023

Conversation

joelharkes
Copy link
Contributor

Added a method that is easier to overwrite in the Exception Handler class or to listen to with APM packages.

For example the Datadog APM tracer would otherwise trace for all exceptions, even those that don't even get logged.

Datadog APM error tracker:

\DDTrace\hook_method(
            Handler::class,
            'reportError',
            function ($This, $scope, $args) {
                $span = \DDTrace\root_span();
                if (null === $span) {
                    return;
                }
                // from: https://github.com/DataDog/dd-trace-php/blob/master/src/Integrations/Integrations/Integration.php
                /** @var \Throwable $exception */
                $exception = $args[0];
                $span->meta[\DDTrace\Tag::ERROR_MSG] = $exception->getMessage();
                $span->meta[\DDTrace\Tag::ERROR_TYPE] = get_class($exception);
                $span->meta[\DDTrace\Tag::ERROR_STACK] = $exception->getTraceAsString();
            }
        );

@joelharkes joelharkes changed the title Add Method to report error [10.x] Add Method to Report only logged exceptions Jun 24, 2023
@taylorotwell taylorotwell merged commit 9f366f6 into laravel:10.x Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants