diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 422d02c..2f34ebe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,6 @@ Feel free to contribute to this project. - Use `pnpm` to manage deps. - Make sure that all your changes fit codestyle, run `pnpm run lint`. -- Make sure that all your changes have tests, run `pnpm run unit`. +- Make sure that all your changes have tests, run `pnpm run test:unit`. - Make sure that all your changes have documented in [README](README.md). - Make sure that all your commits follow conventional commit [guide](https://conventionalcommits.org/). diff --git a/README.md b/README.md index 8cd0778..356b836 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ This plugin also adds two http metrics for your routes: ### v10.x.x - Replace route `context.config` with `routeConfig` due to deprecation in fastify v4 and removal in fastify v5. If you had `disableMetrics` option in you route `config`, update fastify to latest version. +- Prefer `request.routeOptions.method` over deprecated `request.routerMethod`. ### v9.x.x diff --git a/src/fastify-metrics.ts b/src/fastify-metrics.ts index d4f7a1d..b3d1dc2 100644 --- a/src/fastify-metrics.ts +++ b/src/fastify-metrics.ts @@ -302,7 +302,11 @@ export class FastifyMetrics implements IFastifyMetrics { if (this.options.routeMetrics.registeredRoutesOnly === false) { if ( - !this.methodBlacklist.has(request.routerMethod ?? request.method) + !this.methodBlacklist.has( + request.routeOptions?.method ?? + request.routerMethod ?? + request.method + ) ) { this.metricStorage.set(request, { hist: this.routeMetrics.routeHist.startTimer(),