Grouping breadcrumbs to an event

Hi there,

I am using the javascript SDK for node.js server.

I am using a Sentry.withScope(…) each time an error happens and everytime I have an interesting log statement, I also add it as a breadcrumb using Sentry.addBreadcrumb(…).

The problem is that since node.js is asynchronous, I need a way to group the breadcrumbs to the relevant issue, by a request id (which I have both on the error and the log). Otherwise, I might get mixed breadcrumbs from concurrent requests.

How can I achieve this?


1 Like

This is really a good question. I’ve been reading through all the huge docs longing for the answer to this particular question.

This is a very basic requirement from breadcrumbs in an asynchronous environment.

@disfated For now, I’ve implemented patch to overcome this by using to create a per-request global context with an array that I push breadcrumbs to. When an error does occur, I push all of the array’s contents as breadcrumbs to sentry in the same scope of the exception, and then empty the array.

Hope it helps!