Unique Identifier with classes #7290
-
Hi there! This might be confusing, and sorry in advance if it is! My node app initiates multiple classes which use the same code but have different values (multi-tenant I guess?) and I'm trying to figure out how to do proper Sentry error reporting in case there's an error in one of the classes. Some pseudo-code that might help: const clientMap = new Map();
clients.forEach((client) => {
const c = new Client(client.id);
clientMap.set(client.id, c)
c.init();
}); How can I have any errors captured by Sentry show the ID of the client it occurred in? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Usually you would want to use If your code is asynchronous you probably also want to wrap it into a domain in order to avoid scope bleeding. |
Beta Was this translation helpful? Give feedback.
Usually you would want to use
Sentry.withScope()
to isolate the scope and then useSentry.setTag()
to pass the id to the event.If your code is asynchronous you probably also want to wrap it into a domain in order to avoid scope bleeding.