Before '@sentry/node' was released, I used the raven module. Including tags with all of my errors was as simple as including a tags property in the options object when configuring Raven.
Raven.config(DSN, {
tags: {...}
})
How do I include tags when using the new API? So far I've tried:
Sentry.init({
dsn: DSN,
tags: {
process_name: 'webserver',
},
})
and
Sentry.configureScope(scope => {
scope.setTag('process_name', 'webserver')
})
but neither attempt works.
You've to use Sentry.configureScope
, but as mentioned in the sdk docs Note that these functions will not perform any action before you have called init()
.
This should work, otherwise you would have to contact sentry:
const Sentry = require('@sentry/node');
Sentry.init({
dsn: '__DSN__',
// ...
});
Sentry.configureScope(scope => {
scope.setExtra('battery', 0.7);
scope.setTag('user_mode', 'admin');
scope.setUser({ id: '4711' });
// scope.clear();
});