openapm-nodejs icon indicating copy to clipboard operation
openapm-nodejs copied to clipboard

bug: OpenAPM not masking the path in some cases

Open chtushar opened this issue 1 year ago • 1 comments

Describe the bug

After instrumenting the express app. In some cases OpenAPM is not masking the paths using openapm.instrument('express') signature. The paths in the screenshot should be prefixed with /org/:orgId/

Screenshot 2024-05-13 at 5 58 26 PM

To Reproduce Steps to reproduce the behavior:

  1. Generate a demo express application using npx express-generator
  2. Use openapm.instrument('express') as per the documentation
  3. Create a router and use a parameter in the base path
  4. Start the application and make calls to the paths initialized in the router.
  5. localhost:9097/metrics won't have a parameterised routes.

Expected behavior The paths should be parameterized like it is in the screenshot. When the middleware is used directly like this app.use(openapm.REDMiddleware); the behaviour seems to be as expected.

Screenshot 2024-05-13 at 6 08 35 PM

chtushar avatar May 13 '24 12:05 chtushar

@chtushar, Let's unify the signatures and add test coverage. Also share the example to repro this.

prathamesh-sonpatki avatar May 14 '24 03:05 prathamesh-sonpatki