-
Notifications
You must be signed in to change notification settings - Fork 459
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
Newrelic doesn't work with kraken #285
Comments
Off the top of my head I am going to guess that something about the way https://github.com/newrelic/node-newrelic/blob/master/lib/instrumentation/express.js I'd argue that this isn't a Edit: That being said it would be interesting to discover the exact "why". |
FYI: I filed a bug report here on Github in June with a reproducible test case, which they confirmed but never managed to fix. Last month they simply closed all open issues and redirected everyone to their support forum, but I haven't yet filed another issue there. So I guess you could change your router middleware or hope they eventually fix it after you file your issue. Maybe they don't consider kraken big enough to support. |
Thanks. On relative sizes, I'd definitely suggest it's on Kraken's back to isolate and hopefully fix the incompatibility. Or at least tell them exactly what to change in their code. |
@oblador I'm thinking about digging into this (rainy day project, perhaps). Do you still have your test case? What about you, Max? EDIT: worth noting I disagree that the onus is on us. I haven't even begun to look into this but I know that kraken is simply a middleware. We work within the confines of express without doing any sort of mutation. In contrast, the newrelic module—presumbly—does some instrumentation which, by definition, changes how things work. The express surface is our contract; if it changes out from underneath us, that falls outside our developer responsibilities. That said, regardless of where the true engineering "responsibility" lies (which is effectively meaningless), it's impacting a shared portion of our users. At that point, it will boil down to priorities or—in the likely outcome of this case—who needs a rainy day project. 😀 |
Oh I agree from a software design perspective it's not on us. But from a reality perspective and relative size... On us. My appsforhere project has it commented out - commenting it back in will break it right away. |
Thanks. I'll take a look. |
Also running into this issue. Not sure if it helps, but I've found that if there is more than one route defined - even if they are both located in |
Hi, has anyone found a workaround for this? We're pushing to prod soon.. :( |
I saw newrelic tweet about some new support added. Have you tried it? |
Confirmed. Updating to the latest version ( |
Looks like this is the relevant fix: newrelic/node-newrelic@be324bf#diff-44914992336a5a19961dc6c93a5b634fR303 |
Great! |
So it looks like |
I re-enabled newrelic in my app and it still fails (and when I remove it it works). Need to dig more but not sure this is fixed yet. |
I'm unable to get this to work for me either. Anyone have success with it? |
Reopening pending additional verification. |
This line is causing the problem : https://github.com/newrelic/node-newrelic/blob/master/lib/instrumentation/express.js#L406 |
So have we given up on this? |
Didn't NewRelic come out with a new release that should fix this? |
1.12.0 did not fix it for me, if that's the one you mean. |
Well drat. And they say they specifically support Kraken. Grr. |
Interesting. Certainly possible I did something else wrong, but I can confirm that taking the require('newrelic') out makes my app work and putting it in makes all routes fail. |
Oh, I doubt it's you: new relic is super invasive. |
I haven't been to get this to work either
|
any updates on this? |
Went spelunking into the depths of Kraken / New Relic this afternoon. BTW... @aredridel is completely right. NewRelic gets everywhere in your code. |
Thanks @lmarkus!
Can you point me to the offending code? Maybe we can sort this out on our side, too. |
Sure. This is the express function that NewRelic was wrapping: proto.route = function(path){
var route = new Route(path);
var layer = new Layer(path, {
sensitive: this.caseSensitive,
strict: this.strict,
end: true
}, route.dispatch.bind(route));
layer.route = route;
this.stack.push(layer);
return route;
}; A new route is pushed onto the router directly: From what I saw, Kraken keeps a reference to this object via this getter (but it was getting wiped out by NR): // Recursively search for the first non-registry (express) router.
Object.defineProperty(registry, '_router', {
get: function () {
return router._router || router;
}
}); The problem manifested itself here: debug('mounting', current, 'at', mountpath);
subrouter = registry(mountpath, router);
impl(subrouter);
router.use(mountpath, subrouter._router); New routes are appended by Express to |
the fix that @lmarkus created, has been released in version 1.14.0 I am hopeful that kraken will now work correctly with newrelic installed, but I have not done thorough testing of kraken itself. This only fixes the bug in our express instrumentation and it is possible there are other edge cases we have not covered. I am hoping to add proper integration tests for kraken soon, but we thought it was more important to first release fixes for bugs that had already identified. A quick note on the original issue: The original issue brought to our attention was that kraken apps would crash almost instantly with newrelic enabled. As @jasisk pointed out, it was related to the best, |
Fantastic @hayes - really impressed by your attention to the issue! |
May have spoken too soon... I see TypeError: Cannot read property 'partialName' of undefined. - still trying to isolate it. |
As I said before, I did not have time to look into comparability with May have spoken too soon... I see TypeError: Cannot read property — |
As far as I know, this has been resolved. |
Not entirely sure why yet, but if I simply require('newrelic') at the top of the file, routes no longer work. It's meant to work with express 4, thus I implicate kraken (or maybe enrouten)
The text was updated successfully, but these errors were encountered: