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
@@ -1,4 +1,4 @@
import {

Check failure on line 1 in src/fastify-metrics.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

',' expected.

Check failure on line 1 in src/fastify-metrics.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

',' expected.

Check failure on line 1 in src/fastify-metrics.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

',' expected.
FastifyInstance,
FastifyReply,
FastifyRequest,
Expand Down Expand Up @@ -133,7 +133,7 @@
return;
}

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

Check notice

Code scanning / CodeQL

Syntax error Note

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 @@
/** 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
Loading