-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to include tags #1632
Comments
I can confirm that it's an issue when working with express. I'll take care of it this week. |
@samholmes because of pipeline-like nature of Express (its middlewares), a user has to pass the Here's how to work with custom data in Express.js: app.use(Sentry.Handlers.requestHandler());
// Set any data for all the requests
app.use((req, res, next) => {
Sentry.getHubFromCarrier(req).configureScope(scope => {
scope.setTag('process_name', 'webserver')
scope.setExtra('whatever', 'you-need');
});
next();
});
// set data per endpoint
app.get("/foo", req => {
Sentry.getHubFromCarrier(req).configureScope(scope => {
scope.setTag("foo", "my-value");
});
throw new Error("foo!");
});
app.use(Sentry.Handlers.errorHandler()); Also, one thing you have to remember is that if you want to use We'll make sure to document it better. Also we'll release Sentry.configureScope(scope => {
scope.setTag('process_name', 'webserver')
}) Will work as well :) |
and #1637 |
@samholmes ignore my previous comments. We fixed everything internally and starting |
Hey @kamilogorek just to clarify, we can now use middleware and set scope without first setting the hub? app.use((req, res, next) => {
Sentry.configureScope(scope => {
// ...
});
next();
}); will just work? |
@saoudrizwan yes, as long as you attach |
That's magical, great work! |
Above is the code I have in my project. When errors are logged from the express middleware, the process_name tag is not included. This is obviously a bug.
Note: I've also tried:
with no avail.
The text was updated successfully, but these errors were encountered: