Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ Notes:
=== Node.js Agent version 3.x


==== Unreleased

[float]
===== Breaking changes

[float]
===== Features

[float]
===== Bug fixes

* Fix Next.js instrumentation to honour the <<use-path-as-transaction-name>>
config setting. When set to true the APM transaction name for a request to a
Next.js Dynamic Route will use the request path, e.g. `GET /about-us`, rather
than the dynamic route name, e.g. `GET /[...page]`. ({issues}3072[#3072])

[float]
===== Chores


[[release-notes-3.41.0]]
==== 3.41.0 2022/12/12

Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"elastic-apm-node": "elastic/apm-agent-nodejs#main",
"elastic-apm-node": "^3.40.1",
"next": "12.3.1",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ module.exports = function (mod, agent, { version, enabled }) {
// specific route wrapper hasn't already done so.
if (trans && !trans[kSetTransNameFn]) {
trans[kSetTransNameFn] = (req, pathname) => {
trans.setDefaultName(`${req.method} ${pathname}`)
if (agent._conf.usePathAsTransactionName) {
trans.setDefaultName(`${req.method} ${req.url}`)
} else {
trans.setDefaultName(`${req.method} ${pathname}`)
}
// Ensure only the first `findPageComponents` result sets the trans
// name, otherwise a loaded `/_error` for page error handling could
// incorrectly override.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ module.exports = function (mod, agent, { version, enabled }) {
// specific route wrapper hasn't already done so.
if (trans && !trans[kSetTransNameFn]) {
trans[kSetTransNameFn] = (req, pathname) => {
trans.setDefaultName(`${req.method} ${pathname}`)
if (agent._conf.usePathAsTransactionName) {
trans.setDefaultName(`${req.method} ${req.url}`)
} else {
trans.setDefaultName(`${req.method} ${pathname}`)
}
// Ensure only the first `findPageComponents` result sets the trans
// name, otherwise a loaded `/_error` for page error handling could
// incorrectly override.
Expand Down