-
Notifications
You must be signed in to change notification settings - Fork 399
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
chore: add support for hapi 18. #286
Conversation
@NatalieWolfe, @psvet: Any feedback on this PR? :) |
Hey @aorinevo, thanks for the PR. In order for this to get shipped, I'd like to see testing at least in parity with the versions of hapi <18. This can be done by adjusting the versions the There will also need to be some code changes for how hapi is being loaded (not the only place, but many of the tests go through this load path). This will test the new version up to parity with the older versions. It'll miss any new features, and test any deprecated/removed features (which will hopefully cause some test failures, but still something to be weary of). |
With v18 of hapi, request.parameters.* is not respected when passed in attributes.include array. That is, when present, url parameters are not populated in attributes object as For example, server.route({
method: 'GET',
path: '/test/{id}/',
handler: function(request, reply) {
// request.params.id = 1337
t.ok(agent.getTransaction(), 'transaction is available')
return { status: 'ok' }
}
})
agent.on('transactionFinished', function(tx) {
var attributes = tx.trace.attributes.get(DESTINATIONS.TRANS_TRACE)
// attributes['request.parameters.id'] is undefined
})
server.start().then(function() {
port = server.info.port
request( 'http://localhost:' + port + '/test/1337/');
}) I couldn't Identify the root cause of why this is failing for hapi 18 but not hapi 17. Any thoughts? Notes
|
Resolved issue above. The root cause is a pathing issue with the new scope for Hapi v18. That is, files were attempted to be loaded from One way to resolve this issue is to copy over the files to the new path. |
I'm thinking we should have a separate test folder for hapi 18. Thoughts? |
@lykkin, got the tests running and passing for Hapi 18. I took a decision to copy hapi 17 unit tests to another directory for hapi-18 and rename hapi-post-17 to hapi-post-17-pre-18. Let me know what you think. |
Instead, created |
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.
@aorinevo Thanks for taking the time to update the tests! It mostly looks good, just a nit and a couple questions.
Nit: hapi-post-17-pre-18 can be renamed to hapi-17 for clarity.
Question 1: The versions being tested don't cover the first two minor releases of v18, is that intended?
Question 2: This PR brings the hapi v18 support up to parity with the older versions of hapi, but ignores any possible new functionality. Are there any features/changes that might be important to support in v18 that would be worth documenting as TODO?
Thanks for the review @lykkin!
Is this sufficient to move forward with the PR? |
@aorinevo Yep! Looks like everything is in order at this point. I'll open this up as a PR against our internal repo and we can get it out in the next couple of releases. Thanks again for putting all this together! |
Just found this PR after troubleshooting the same issue for a while. Thanks for doing this! Do you have a rough estimate of when this might get merged and published? It'd be really great to have this fixed. |
Hi @mattcphillips, this should be going out in the next couple of releases, although no set date has been shared. In the interim, you might want to consider creating a scoped version of this fork or installing off of a github url. If the latter, I would recommend forking first and installing off of that. We decided to go with a private scoped version of this fork for stability and security reasons. Hope this helps :) |
CHANGE LOG
lib/instrumentations.js
INTERNAL LINKS
NOTES
require('hapi')
whereas Hapi 18+ users require the framework viarequire('@hapi/hapi')
. Hence, no chance of collision.hapi
module name, then no change is required./*
. To fix this, users can set theNEW_RELIC_NAMING_RULES
env var with appropriate rules objects (see https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration#rules_config ).Tests
@hapi/hapi
similar to pre/post hapi 17 unit tests although much more lightweight.