Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds fastify v3 middleware mounting and fixes mount location naming #938

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

michaelgoin
Copy link
Member

@michaelgoin michaelgoin commented Oct 4, 2021

Proposed Release Notes

  • Added middleware mounting for fastify v3.

  • Fixed capturing of mount point for middleware naming.

Links

Details

Note: the inclusion of the hook that fires the middleware 'onRequest' does result in awkward UI formatting with the old UI which does auto formatting.

Without it, you would see something like Middleware: pathMountedMiddleware /async-return. With it, you see: Middleware: onRequest pathMountedMiddleware//async-return.

The newer UI doesn't do any formatting currently so has no impact.

Converts to use wrapMiddlewareMounter and properly set route.
@michaelgoin michaelgoin added risk: low This change does not impact critical areas of the code and is expected to have minimal risk. semver: minor New features added. labels Oct 4, 2021
@michaelgoin michaelgoin changed the title Fastify use Adds fastify v3 middleware mounting and fixes mount location naming Oct 4, 2021
@bizob2828 bizob2828 self-requested a review October 4, 2021 20:07
Copy link
Member

@bizob2828 bizob2828 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice refactor and add add'l context for middleware that is registered via .use with mount points

}

const args = shim.argsToArray.apply(shim, arguments)
args[1] = shim.wrapMiddlewareMounter(args[1], mounterSpec)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work on including route when applicable. TIL. also nice abstraction on code between fastify 2 and 3 instrumentation

@michaelgoin michaelgoin merged commit b703aac into newrelic:main Oct 4, 2021
@michaelgoin michaelgoin deleted the fastify-use branch October 4, 2021 22:09
@github-actions github-actions bot mentioned this pull request Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
risk: low This change does not impact critical areas of the code and is expected to have minimal risk. semver: minor New features added.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Fastify GA: wrap fastify.use after decorate is called in v3 of Fastify
2 participants