apollo-server icon indicating copy to clipboard operation
apollo-server copied to clipboard

Add a name to the middleware function

Open gsoltis opened this issue 1 year ago • 3 comments
trafficstars

This is a small quality-of-life improvement. As the code comment says, some observability/instrumentation libraries rely on Function.name for the name of express middleware to use in a span. @opentelemetry/instrumentation-express is one example.

This PR returns a named function, rather than an anonymous function, and adds a test to ensure that the middleware is named.

gsoltis avatar Nov 15 '24 19:11 gsoltis

@gsoltis: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

apollo-cla avatar Nov 15 '24 19:11 apollo-cla

✅ Docs Preview Ready

No new or changed pages found.

svc-apollo-docs avatar Nov 15 '24 19:11 svc-apollo-docs

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Nov 15 '24 19:11 codesandbox-ci[bot]

This functionality is now in separate packages (https://github.com/apollo-server-integrations/apollo-server-integration-express4 and https://github.com/apollo-server-integrations/apollo-server-integration-express5).

glasser avatar Jul 03 '25 23:07 glasser