-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: Breadcrumbs #210
feat: Breadcrumbs #210
Conversation
Hi @MindscapeHQ/kai-miquel-and-friends I'd like you to take a look at the current implementation while I am finishing documentation and examples, and get some feedback and questions from you. |
The output looks correct to me:
Nevertheless, I will change it to follow the rest of the files. |
Did some more cleanup, updated README with Breadcrumb documentation, and applied many of the suggestions from Kai. I mark this now as ready for review, I think it is in a state which is usable and good enough to go as first implementation. |
Yeah that output does look like I'd expect it to be. |
I just gave it another look and I think it's good and my concerns/remarks are all addressed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the review! I'll go ahead and merge to develop, if we want to do any changes, we can do it before the release in a new PR |
app.use("/", routes); | ||
``` | ||
|
||
This middleware can be user together with the provided ExpressJS error handler `expressHandler`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"used" instead of "user"
// uncomment after placing your favicon in /public | ||
// app.use(favicon(__dirname + '/public/favicon.ico')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The favicon was missing in the /public folder, this should be cleaned up, or we need a favicon. I'll see if we can get a raygun one.
@@ -58,7 +47,9 @@ app.use(express.static(path.join(__dirname, "public"))); | |||
app.use("/", routes); | |||
app.use("/users", users); | |||
|
|||
// Add the Raygun Express handler | |||
// Add the Raygun error Express handler | |||
app.use(raygunClient.expressHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it (express naming usage) is too tightly coupled at the moment. But until we see popular requests for other frameworks, I'm happy with the current implementation until we implement support for other frameworks. I think the new approach looks good (moving to raygun.breadcrumbs.express.ts
).
But does a standalone node app need breadcrumbs tracked manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But does a standalone node app need breadcrumbs tracked manually?
Yes, users would need to manually add breadcrumbs.
The expressBreadcrumbsHandler
only adds a single breadcrumb for requests, so it isn't a big difference nevertheless.
@sumitramanga I will submit the suggestions in a new PR |
feat: Breadcrumbs
Description 📝
breadcrumbs
and ported it to the latest codebase.Type of change
Updates
The main idea is that breadcrumbs are automatically scoped to the current request in ExpressJS.
Breadcrumbs are also added automatically with the request information.
For that, users must add the
expressHandlerBreadcrumbs
middleware to their ExpressJS app:Then, users can also add their own custom breadcrumbs calling to
addBreadcrumb()
in the scope of a request.As well, users can continue using the Raygun ExpressJS handler:
When an error is captured by the
expressHandler
, or the user calls toraygun.send()
, the breadcrumbs in the current scope will be attached to the message details payload automatically.At any point in time, users have the option to discard all the stored breadcrumbs if they so desire:
Besides supporting scope by request, breadcrumbs are added to a global scope when calling
addBreadcrumb()
outside the scope, and will be included in any error sent outside of request scopes.Internally, the implementation uses
AsyncLocalStorage
to handle scopes within requests.Quoting the original PR:
Expanded Express example
The ExpressJS example has been expanded this way:
/send
endpoint which sends a custom Raygun error./error
endpoint.Example of how Breadcrumbs appear:
As raw data:
Test plan 🧪
test/raygun_breadcrumbs_test.js
.Author to check 👓
Reviewer to check ✔️