Open girish7999 opened 2 years ago
Formally right solution: normalizePath
also takes the function and let's you do any custom replacement you like.
It will not work with the array of regex, because those replacements are matched against individual chunks. In your example if the path is: /api/v1/engagements/345472387234/features
, then the path is split into chunks and then analyzsed?
api
looks like an id? Nov1
looks like an id? Noengagements
looks like an id? No345472387234
looks like an id? Yes! Replace it with regex. At this point you don't know what the preceding parts wereActually right solution: don't customize anything. You're missing the point of this library. It's meant to work with an unknown paths and provide good results. So that when you add a new API tomorrow /api/v2/raccons/{racoonId}/furr-color
it would still replace racoon IDs with #val
without you need to touch anything. Look at your API. After /engagements
there can be nothing else than engementId
so replacing with {engementId}
, #val
or foobar
will work just the same - provide one path for all possible ids.
Current values using the 'express-prom-bundle' module:
attribute: path Value: "/api/v1/engagements/#val/features" "/api/v1/engagements/#val" "/api/v1/engagements/#val/data/workspace/assets/#val/unzip"
But we are expecting the metrics report to come up with the below values:
attribute: path Value: "/api/v1/engagements/{engagementId}/features" "/api/v1/engagements/{engagementId" "/api/v1/engagements/{engagementId}/data/workspace/assets/{assetId}/unzip"
I already tried the below normalizePath expressions:
normalizePath: [ ['^/api/v1/engagements/./features', '/api/v1/engagements/{engagementId}/features'], ['^/api/v1/engagements/.', '/api/v1/engagements/{engagementId}'], ]