-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add Koa auto tracing documentation #1781
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
Conversation
Also working on some auto span on monitoring middleware and routers, might add later
ctx.__sentry_transaction = transaction | ||
await next() | ||
|
||
// if using koa router, a nicer way to capture transaction using th ematched route |
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.
// if using koa router, a nicer way to capture transaction using th ematched route | |
// if using koa router, a nicer way to capture transaction using the matched route |
@arthurM2x Nice! Just to confirm, did this setup work for your Koa app? I tried setting up a simple Koa app using the example you wrote, and added a simple handler: app.use(async ctx => {
ctx.body = 'Hello World';
}); which generated an error: $ node index.js
Error: Express middleware takes 2-4 arguments. Got: 1
at wrap (/sentry/koa-apm/node_modules/@sentry/apm/dist/integrations/express.js:101:19)
at /sentry/koa-apm/node_modules/@sentry/apm/dist/integrations/express.js:118:20 However, it works fine if I added an un-used 2nd parameter: app.use(async (ctx, next) => {
ctx.body = 'Hello World';
}); Hence I'm unsure if the @rhcarvalho @kamilogorek @HazAT can you confirm? |
// enable HTTP calls tracing | ||
new Sentry.Integrations.Http({ tracing: true }), | ||
// enable Express.js middleware tracing | ||
new Apm.Integrations.Express({ app }) |
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.
Apm
is undefined here.
my bad, copy pasted the above code without thinking
My bad, copied the code above without removing the express integration part, the middleware works in my koa application |
@arthurM2x thanks! just a heads up; my colleague, @doralchan, is in the midst of a major refactor for the Performance and Tracing docs: #1782 That might take priority and is slated to be merged soon. The PR should enable any new additions of tracing docs for specific frameworks/libraries such as Koa. You'll need to rebase your changes after that PR is merged. |
@arthurM2x Looks like the changes at #1782 are merged. would you be able to move the Koa tracing content to this folder? https://github.com/getsentry/sentry-docs/tree/master/src/collections/_documentation/performance-monitoring/configuration |
Going to close this one as super seeded by #1804 |
Also working on some auto span on monitoring middleware and routers, might add later