-
Notifications
You must be signed in to change notification settings - Fork 534
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: Hapi auto-instrumentation #171
Conversation
chore: more setup feat: finished wrapping for server.route feat: tracing for individual routes fix: add hapi router tests, add plugin end logic chore: testing with server feat: adding instrumentation for Hapi.server, Hapi.Server [sic], and Hapi plugin register function feat: improve tests + edge case coverage feat: enforcing that each route/plugin is instrumented at most once feat: add Hapi example code chore: update README Add files via upload chore: add example images fix: modifying type definitions and coverage feat: refactoring to add custom span name and attributes for plugins chore: add tests for package-based plugins chore: update example photos Delete jaeger.jpg Delete zipkin.jpg chore: update example photos chore: update examples feat: adding instrumentation for server.ext functions chore: add tests for extensions added within plugin fix: update example fix: update example photos to include ext spans fix: update example code to include request extension instrumentation chore: update README docs: add tsdoc comments for Hapi plugin functions chore: bump version to 0.9.0 chore: fix style fix: more test updates
Codecov Report
@@ Coverage Diff @@
## master #171 +/- ##
==========================================
+ Coverage 94.61% 95.23% +0.62%
==========================================
Files 84 93 +9
Lines 4124 4767 +643
Branches 432 493 +61
==========================================
+ Hits 3902 4540 +638
- Misses 222 227 +5
|
Hapi itself is incompatible with Node versions <12.x.x, so the builds using node8 and node10 are expected to fail. Is there a recommended way to handle this and update the CircleCI config so it just checks node12 (and node14 if possible)? |
This would be done directly in the For an example of how to skip a test you can look at mysql/pg/mongo which are skipped during normal operation. It goes something like this: describe('this suite only runs in node 12+', () => {
if (!semver.satisfies(process.version, '>=12.0.0')) {
this.skip();
}
it('this test is skipped in node 10', () => {});
}); |
Okay, thank you for the response, I'll add that now! |
2952602 seems to work, but is there some reason you decided to do it in the mocha config rather than in the tests like I suggested? I'm not saying your approach is worse, just interested in why you decided to do it that way. |
@dyladan Yes, there is! The build failure earlier was happening when the Hapi module was imported at the top of each test file, so it was still failing when I tried skipping the individual tests. With the mocha config, it checks the node version before loading any of the test files, so it doesn't run into the same build issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @carolinee21 thanks for the contribution
Which problem is this PR solving?
Short description of the changes
This instrumentation provides automatic tracing for hapi server routes and (request lifecycle extensions)[https://github.com/hapijs/hapi/blob/master/API.md#request-lifecycle] defined either directly or via a Hapi plugin.
Some example traces are shown here:
User friendly example code is also added under examples/hapi
A visual diagram of the structure of this new instrumentation is provided here:
Note: this build is currently affected by the compilation errors which will be fixed via fix: various compilation errors #170