Description
As discussed at https://discuss.elastic.co/t/next-js-and-dynamic-routes/321302 the current Next.js instrumentation that sets the transaction.name
for a Dynamic Route does not honour the usePathAsTransactionName: true
config var. That means that a request GET /a-dynamic-route/42
to this dynamic route https://github.com/elastic/apm-agent-nodejs/blob/main/test/instrumentation/modules/next/a-nextjs-app/pages/a-dynamic-page/%5Bnum%5D.js results in transaction.name = 'GET /a-dynamic-route/[num]
even if usePathAsTransactionName: true
.
Note that there is also naming of the Next.js _data/route ...
transactions for possibly dynamic routes -- e.g. "Next.js _next/data route /a-dynamic-page/[num]". However, I don't think those should honour usePathAsTransactionName
. At least not without user feedback.