GithubHelp home page GithubHelp logo

Comments (2)

luke-belton avatar luke-belton commented on May 25, 2024 1

Hi @jwadhams - we've just released https://github.com/bugsnag/bugsnag-laravel/releases/tag/v2.25.0, which adds the max_breadcrumbs config option 🎉

from bugsnag-laravel.

xljones avatar xljones commented on May 25, 2024

Hey @jwadhams, thanks for raising the issue and providing the repro to explain exactly what the issue you're seeing is. Sorry for the delay in getting back to you, we've been having some internal discussions this topic 😄 .

leaveBreadcrumb seems to correctly isolate data between Laravel queued jobs processed with Horizon workers. I love it, but sometimes, especially with query logging turned on, important breadcrumbs from early in the job appear to be pushed out by later ones.

Breadcrumbs are contextual to the job, so they should be specific to that one process. We've added a roadmap ticket to make the number of breadcrumbs a) configurable, and b) more than 25! We'll keep you posted.

In BugSnag, the Breadcrumbs never "cross the streams" but the Metadata routinely do. Using merge:true in setMetaData` only means one random status will be set, it doesn't guarantee the right one, because of the delay. (The delay in my real jobs is based on i/o)

Metadata, on the other hand (by comparison to breadcrumbs) is global when set in the app-level. You're right, using merge would condense the array down into a single element, and it wouldn't deterministically report the right state because the jobs are async. You could use a event-scoped callback on errors occuring inside of the job to set metadata.

In any case, I suspect that the increase to breadcrumb numbers would be a satisfactory solution long term anyway?

I noticed this alternate approach in the issues backlog, is using Tracker the preferred solution for queue workers? #448 It doesn't appear anywhere in the integration guide.

Using the Tracker as the linked issue suggests should do what you want. However, it's intended for internal use, hence why it's not documented. This API is not ideal for public use, and so you'd need to merge the existing metadata manually to not lose the automatic metadata Bugsnag records:

/** @var \Illuminate\Queue\QueueManager $queueManager */
$queueManager->before(function (\Illuminate\Queue\Events\JobProcessing $event) {
    $tracker = app(\Bugsnag\BugsnagLaravel\Queue\Tracker::class);
    $tracker->set(
        array_merge(
            $tracker->get(),
            [/* your metadata goes here */]
        )
    )
});

from bugsnag-laravel.

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.