-
Notifications
You must be signed in to change notification settings - Fork 404
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
Make agent.transactionNameNormalizer load config data. #69
Conversation
Hey, Eirik, thanks for the pull request! We're not going to accept it, but I'll explain what's going on here, and maybe that will be a good enough substitute. Here's the logic the agent follows when naming transactions:
I know the interplay between steps 1-3 can be confusing, but our rationale in designing it to work that way is that using the route names is going to be sufficient for the majority of people using Express / Restify, and the naming and ignoring rules are a way for users who are running without a framework to group together large numbers of requests without their metrics getting backstopped to |
Wow. Thanks for a quick and elaborate response. I had the feeling this was not an oversight! I think I understand the flow of it. However, I still I can not get ignoring to work, though (I realize this is looking more like a support request now, but I hope you bear with me :p) In the documentation there is a snippet about ignoring socket.io's poll path. It is referenced as this:
My use-case is very similar. I want to ignore /poll, because it is used for long-polling. I have tried all kinds of combinations, and for what I can find out, it ends up not being ignored because of this (from line 113 in transaction.js):
Since
(which also makes ignoring work again)? Following your answer I can now rename my transactions, but I can not ignore neither the renamed transaction or the "original" transaction. Am I just doing everything wrong here? Very grateful that you took the time to respond in such a way, and it would be awesome if you could hint me in what direction I am doing something wrong here. |
I think you've hit upon a hole in the transaction-naming API, but first: is your /poll route being handled by Express or Restify right now? That's consistent with what you're saying, so let me provide a little more context (someday I'll run out!): If you're using Express / Restify, the name for the transaction is being set by the New Relic code that grabs the route names from the router. Since the name is already set by the time the final call to name the transaction is made, the URL normalizer, which includes the ignoring rules, isn't run on the transaction, because the name isn't going to be URL-based. I see why using the transaction name normalizer is appealing there, but New Relic needs to reserve that escape hatch for itself. What I think needs to be there but isn't right now, is an API call that just says "ignore this transaction". I'll need to talk this over with my team here, but if that's the case, it's an easy addition to the API and may be in a point release soon. If you wanted to try hacking it in for yourself in the meantime, if you look in API.prototype.setIgnoreTransaction = function (ignored) {
var transaction = this.agent.tracer.getTransaction();
if (!transaction) {
return logger.warn("No transaction found when trying to ignore one.");
}
transaction.ignore = ignored;
}; (method name is kinda gross, but that's what our other language APIs use, so Node will probably follow its lead when I do that for real) This will also automatically add another call to the stub API that gets exported when New Relic is disabled (via the configuration, obvs you still need to require the module so you can get the API), so you can add setIgnoreTransaction calls to your route handlers without worrying about it incurring overhead (or crashing) when you've disabled New Relic. If you give that a shot, let me know how it goes! |
upgraded setup-node to v2 and changed linting version to `lts/*`
Update readme with community-plus header
Adds GitHub Actions CI. Removes Travis.
Adds GitHub Actions CI. Removes Travis.
Howdy, thanks for a great service and module.
I tried to add some config rules to ignore a path in my app, but ended up doubting my regexp skills, since they were not taken into account. So I started debugging, and found that the agent.transactionNameNormalizer does not load from config, thus not loading my ignore rules. This patch fixes that.
I must note that this was just a quick debugging from my side, but surely you guys can quickly see if this was indeed something you overlooked, or if there is something else wrong.
Should probably have a quick test too?
Anyways. Thanks again. Hope this helps.
(btw, sorry for the duplicate. Accidentally committed as my vagrant machine)