-
Notifications
You must be signed in to change notification settings - Fork 158
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
[Feature] Error Tracking via logs #2628
Comments
Hi @TheLevti 👋 Thanks for opening this feature request! On my sandbox, I've tried the following: 1. Sending a sample exception try {
// ...
} catch (\Exception $e) {
Log::error('An error occurred', [
'error.message' => $e->getMessage(),
'error.kind' => get_class($e),
'error.stack' => $e->getTraceAsString(),
]);
} Nota Bene: Monolog with JSON formatting 2. Adding the necessary remapping pipelines The above currently adds the error information under the Result With the two above steps being done, I can get my errors in error tracking, as shown by the screenshots below: To ensure that Error Tracking can capture errors in your PHP code, we can add three remappers to the default PHP pipeline. However, while we work on implementing this, you may add these remappers to your pipeline on your end as well. This will prevent you from waiting for us to add them to our backend. Please let me know if this aligns with your requirements or if I have misunderstood your request. Thank you for your collaboration! |
Great! I was attempting something similar, instead I added a datadog processor that would populate those fields in the What I did not do is adding remapping settings, but instead added my own custom JsonFormatter that would move the error array out of extras into the root. So it should have also worked, or? I will try to do how you did it. Would be nice if the default php remappers can check both, the extras and context array. Thank you for the hints, will let you know if it worked. |
Are there any plans to support default monolog behaviour ( |
Context should not be polluted with meta data. Thats what the extra collection is for. Context must be strictly related to the logged message. |
Right, but even using |
Describe the feature you'd like
Basically we are currently integrating error tracking via RUM, APM and LOGS. Because of APM being heavily sampled, we want to rely more on log error tracking.
Unfortunately the documentation is lacking support for error tracking via php https://docs.datadoghq.com/logs/error_tracking/backend/?tab=serilog#php
It would be really nice if the php-dd-trace extension is also able to support error tracking via logs. e.g. when using monolog and the errors/critical context has a Throwable object, make sure it gets picked up properly by the error tracking feature.
Is your feature request related to a problem?
No response
Describe alternatives you've considered
I have also attempted to provide a custom formatter to set the specified generic fields
error.stack
,error.message
anderror.kind
, but it seems like datadog does not convert/does not pick up those logs into the error tracking component.Is there a non sdk specific documentation about what is the bare minimum that needs to be provided in the logs to be considered to be picked up in the error tracking component?
Additional context
No response
The text was updated successfully, but these errors were encountered: