Skip to content
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

Add hook names #94

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions src/fastify-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class FastifyMetrics implements IFastifyMetrics {
return;
}

this.deps.fastify.addHook('onRoute', (routeOptions) => {
this.deps.fastify.addHook('onRoute', function onRouteMetrics(this: FastifyMetrics routeOptions) {

Check notice

Code scanning / CodeQL

Syntax error

Error: ',' expected.
// routeOptions.method;
// routeOptions.schema;
// routeOptions.url; // the complete URL of the route, it will include the prefix if any
Expand Down Expand Up @@ -292,7 +292,7 @@ export class FastifyMetrics implements IFastifyMetrics {
/** Collect per-route metrics */
private collectRouteMetrics(): void {
this.deps.fastify
.addHook('onRequest', (request, _, done) => {
.addHook('onRequest', function onRequestMetrics(this: FastifyMetrics, request, _, done) {
if (
request.routeOptions.config.disableMetrics === true ||
!request.raw.url
Expand Down