-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(v8/node/nestjs): Use method on current fastify request (#15104)
Backports #15066 --------- Co-authored-by: tjhiggins <[email protected]>
- Loading branch information
Showing
6 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,10 @@ interface Fastify { | |
* Works for Fastify 3, 4 and presumably 5. | ||
*/ | ||
interface FastifyRequestRouteInfo { | ||
method?: string; | ||
// since [email protected] | ||
routeOptions?: { | ||
url?: string; | ||
method?: string; | ||
}; | ||
routerPath?: string; | ||
} | ||
|
@@ -107,7 +107,7 @@ export function setupFastifyErrorHandler(fastify: Fastify): void { | |
// Taken from Otel Fastify instrumentation: | ||
// https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts#L94-L96 | ||
const routeName = reqWithRouteInfo.routeOptions?.url || reqWithRouteInfo.routerPath; | ||
const method = reqWithRouteInfo.routeOptions?.method || 'GET'; | ||
const method = reqWithRouteInfo.method || 'GET'; | ||
|
||
getIsolationScope().setTransactionName(`${method} ${routeName}`); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters