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

Hapi 17 #146

Merged
merged 3 commits into from Jan 3, 2018
Merged

Hapi 17 #146

merged 3 commits into from Jan 3, 2018

Conversation

Qard
Copy link
Contributor

@Qard Qard commented Dec 28, 2017

This adds hapi v17 support.

@Qard Qard changed the title Hapi 17 WIP: Hapi 17 Dec 28, 2017
@Qard Qard requested a review from watson December 28, 2017 19:50
@Qard Qard force-pushed the hapi-17 branch 3 times, most recently from 212476c to ecf2f0e Compare December 28, 2017 23:25
@codecov-io
Copy link

codecov-io commented Dec 29, 2017

Codecov Report

Merging #146 into master will decrease coverage by 0.37%.
The diff coverage is 74.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #146      +/-   ##
==========================================
- Coverage   79.52%   79.14%   -0.38%     
==========================================
  Files          39       39              
  Lines        1939     1947       +8     
==========================================
- Hits         1542     1541       -1     
- Misses        397      406       +9
Impacted Files Coverage Δ
lib/instrumentation/modules/hapi.js 75.4% <74.5%> (-13.27%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a48b49...e66b48d. Read the comment docs.

@Qard
Copy link
Contributor Author

Qard commented Dec 29, 2017

@watson Looks like it's working here. I'll get it cleaned up tomorrow and perhaps you can review it when you're back to work?

@Qard Qard force-pushed the hapi-17 branch 2 times, most recently from 692dbd4 to ee81389 Compare December 29, 2017 23:55
// When the hapi server has no connections we don't make connection
// lifecycle hooks
var conns = server.connections
if (conns && conns.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs an hapi 17 check since in hapi 17 connections are not a thing any more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The existence check of server.connections covers that.

Copy link
Member

Choose a reason for hiding this comment

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

I guess what @AdriVanHoudt means is that outputting the debug message "unable to enable hapi instrumentation on connectionless server" isn't really that nice if running hapi 17?

So it should be more like if (!hapi17plus && conns && cons.length === 0) { where hapi17plus is a boolean that's true only of we're running hapi version 17 or higher.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'd never reach that debug message on hapi 17, because server.connections would have to exist.

Copy link
Member

Choose a reason for hiding this comment

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

Ah my bad 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

it was more for correctness ^^

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I see it can be a little confusing to read because of the above comment. How about just updating the comment to something like:

// Prior to hapi 17, when the server has no connections we can't make connection
// lifecycle hooks (in hapi 17+ the server always have connections, though the
// `server.connections` property doesn't exists, so this if-statement wont fire)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

return
}

// Hooks that are only allowed when the hapi server has connections
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a 100% correct statement anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

The check is still fine afaik

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@watson Any thoughts on wording here?

Copy link
Member

@watson watson Jan 2, 2018

Choose a reason for hiding this comment

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

@AdriVanHoudt Do you mean related to the removal of multi-connections support in hapi 17? What would be a more appropriate comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can tell hapi 17 will have it always.
In 16 it only becomes available after adding a connecting but in 17 you can't run a server without it. The moment you create the server the ext will be there in 17.
So maybe When we can hook into the lifecycle to do proper transaction naming or something?

Copy link
Member

Choose a reason for hiding this comment

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

@AdriVanHoudt how about just Hooks that are only allowed when the hapi server has connections (with hapi 17+ this is always the case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

@Qard Qard changed the title WIP: Hapi 17 Hapi 17 Jan 2, 2018
@Qard Qard removed the in progress label Jan 2, 2018
@Qard Qard added this to Review in Schedule Jan 2, 2018
@Qard Qard force-pushed the hapi-17 branch 2 times, most recently from c5c672e to 8b68ed7 Compare January 2, 2018 20:18
@watson watson merged commit d962515 into elastic:master Jan 3, 2018
Schedule automation moved this from Review to Done Jan 3, 2018
@Qard Qard deleted the hapi-17 branch January 3, 2018 21:14
@watson watson removed this from Done in Schedule Jan 9, 2018
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.

None yet

4 participants