Code Monkey home page Code Monkey logo

Comments (5)

PROFeNoM avatar PROFeNoM commented on July 20, 2024

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 context array; hence, the pipeline would need to be enhanced with three remappers, remapping each of these context.error.X to error.X

Result

With the two above steps being done, I can get my errors in error tracking, as shown by the screenshots below:

image image image

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!

from dd-trace-php.

TheLevti avatar TheLevti commented on July 20, 2024

Great! I was attempting something similar, instead I added a datadog processor that would populate those fields in the extras array to not pollute the given context from the application (if context.exception is provided of course).

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.

from dd-trace-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.