I have a Node JS app that has a URL like this:
/app/:vehicleNumber/details
It takes vehicle numbers dynamically in URL.
The prom-client based metrics API for HTTP calls is returning all the URLs as separate URLs instead of clubbing them as a single URL with vehicleNumber as a variable.
http_request_duration_seconds_bucket{le="0.003",status_code="200",method="GET",path="/app/GJ98T0006/details"}
http_request_duration_seconds_bucket{le="0.003",status_code="200",method="GET",path="/app/KA28T6511/details"}
.....
I want the count based on a single URL. e.g.
http_request_duration_seconds_bucket{le="0.003",status_code="200",method="GET",path="/app/{var}/details"}
It is happening when a UUID is present in the URL but not for vehicle numbers present in the URL.
Assuming you're using Express, you likely want something like:
path
will be/app/:vehicleNumber/details
. Thereq.route
part may not be necessary for your use case, but it doesn't hurt -- it comes in to play if you're usingexpress.Router({ mergeParams: true })
to compose your routes.