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

feat: include hooks not within route handler when wrapping routes #65

Merged
merged 1 commit into from
Mar 5, 2024
Merged

feat: include hooks not within route handler when wrapping routes #65

merged 1 commit into from
Mar 5, 2024

Conversation

10xLaCroixDrinker
Copy link
Contributor

This approach will capture all hooks called on a request when wrapping routes rather than just the route handler itself.

I think this might not match the intention of your API design though. If that's the case, perhaps this could be a new option.

Right now, in my application I'm doing this instead of using wrapRoutes

    fastify.register(openTelemetryPlugin);
    fastify.addHook('onRequest', (request, reply, done) => {
      const { context } = request.openTelemetry();
      openTelemetry.context.with(context, done);
    });

@HW13 HW13 self-assigned this Mar 4, 2024
Copy link
Collaborator

@HW13 HW13 left a comment

Choose a reason for hiding this comment

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

This is great! Thanks @10xLaCroixDrinker! 🙌 🚀

@HW13 HW13 merged commit 3b7b9e2 into autotelic:main Mar 5, 2024
3 checks passed
@10xLaCroixDrinker 10xLaCroixDrinker deleted the feature/wrap-all-hooks branch March 5, 2024 20:10
@HW13 HW13 mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants