last9 / openapm-nodejs

APM for NodeJS using Prometheus
https://last9.io
Apache License 2.0
62 stars 4 forks source link

bug: OpenAPM not masking the path in some cases #49

Open chtushar opened 4 months ago

chtushar commented 4 months ago

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

prathamesh-sonpatki commented 4 months ago

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