When using wildcards in route matchers of express, the base route is not added as one of the recorded paths. For example, the following server setup will not record requests to http://localhost:3001:
Make requests to http://localhost:3001 & http://localhost:3001/other
View http://localhost:3001/swagger-stats/metrics. Note that the path /other is present for some requests, but / is not.
Expected Behavior
I expect to see path="/" as one of the requests in metrics.
Other notes
Interestingly, the only way I've been able to get metrics on the root route to work is by removing the wildcard route handler AND switching to swaggerOnly: false.
I tried commenting out the code here and it started working as I expected, but I didn't test it thoroughly and don't know if removing it might be breaking something else.
Problem
When using wildcards in route matchers of express, the base route is not added as one of the recorded paths. For example, the following server setup will not record requests to
http://localhost:3001
:Steps to reproduce
(Using node v18.19.0)
npm install
node server.mjs
http://localhost:3001
&http://localhost:3001/other
http://localhost:3001/swagger-stats/metrics
. Note that the path/other
is present for some requests, but/
is not.Expected Behavior
I expect to see
path="/"
as one of the requests in metrics.Other notes
swaggerOnly: false
.