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

Add preliminary support for instrumenting Express v5

Open davidfoliveira opened this issue 6 months ago • 4 comments

Adds preliminary support for Express v5 by:

  • Wrapping around express.Router.prototype instead of express.Router, since in v5 express.Router.use() doesn't exist;
  • Sets the redMiddlewareAdded flag on a per router basis;

davidfoliveira avatar Jul 23 '25 16:07 davidfoliveira

Hey @davidfoliveira, Appreciate the pull request ❇️

We are recommending folks to use OpenTelemetry SDKs for metrics these days. Are you using OpenAPM?

prathamesh-sonpatki avatar Jul 23 '25 19:07 prathamesh-sonpatki

Hey @davidfoliveira, Appreciate the pull request ❇️

We are recommending folks to use OpenTelemetry SDKs for metrics these days. Are you using OpenAPM?

Hi @prathamesh-sonpatki ! Yes, my team is using it on an internal project integrated with Parse Server. However, since the latest version of Parse Server uses express v5 we stopped having service metrics. We believe this change will allow it to work again.

davidfoliveira avatar Jul 24 '25 09:07 davidfoliveira

Have you also verified it works for Express 4? I am okay to cut a release for Express 5 if it is not backward compatible.

prathamesh-sonpatki avatar Jul 24 '25 12:07 prathamesh-sonpatki

@prathamesh-sonpatki It was initially meant to be backwards compatible but it wasn't. Now it's working with both express v4 and v5

davidfoliveira avatar Jul 24 '25 15:07 davidfoliveira