Open fritzfs opened 11 months ago
Hi. Since v6 was a long time ago, I don't exactly remember what capabilities are present in fastify v3. However you may try to check out how it's done in recent version. There metrics are created for routes reported in onRoute
hook and there urls are coming in format like you've mentioned: /api/v1/projects/{id}
.
Also you may try to check if it's possible to do what you need through route config - it might be that there's config option to override label.
In worst case scenario you can just disable default route metrics collection, and copy-paste part of code from this lib and add your own metrics and report them instead with correct labels.
Is there a way to enable some sort of heuristic for grouping labels or manually specifying routes because with default configuration, my metrics is becoming too big? It has records for each possibly route /api/v1/projects/{id}.
For version 6.x.
Here are the records just for 2 requests - /api/v1/projects/2 and /api/v1/projects/3.
Thank you!