NewRelic - How to Ignore part of a web application
Asked Answered
P

4

14

I'd like to tell NewRelic to not monitor a subset of my web application. For example I'd like to exclude http://mysite/admin/* so NewRelic won't count traffic against this portion of my app against my apdex.

Something similar to how you can create filters in Google Analytics would be great.

Popper answered 3/2, 2012 at 17:53 Comment(0)
M
11

You can exclude a transaction from counting toward Apdex by calling IgnoreApdex in the New Relic .NET agent API. Add a reference to NewRelic.Agent.Api.dll in your project, then call that method in the code path common to your admin pages.

You can also ignore a transaction entirely (no Apdex, no response time, etc.) by calling IgnoreTransaction.

Minneapolis answered 3/2, 2012 at 18:14 Comment(3)
Hate that I have to add dependency in my project for this. Ideally this should be done at the configuration level and not at the API level.Popper
I'm with you on that. We're considering a way to do this through the web UI (and likely with a REST API, too).Minneapolis
@rkb: I was wondering if there has been any progress on this matter in the two years since this question was asked? Is there any way to do this via configuration or the Web UI yet?Ludwog
E
6

I'm just going to add this if someone else is looking for the same thing. The new agents now allows exclusion in the config-file, check out the answer below from their support:

The second less intrusive way is to use a "Request Path Exclusion List". The browserMonitoring-element in newrelic.config now supports (as of agent version 2.22.79.0) an optional sub-element named requestPathsExcluded, as shown below:

<browserMonitoring autoInstrument="true">
   <requestPathsExcluded>
      <path regex="About{1}?" />
      <path regex="mvcForm/Home/{1}?" />
   </requestPathsExcluded>
</browserMonitoring>

Each "path" element must contain a "regex" attribute whose value is a regular expression that can be evaluated by the .NET Framework's Regular Expression evaluator. See http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.90).aspx as a reference.

Estriol answered 19/8, 2014 at 12:10 Comment(0)
W
5

Bit late to this but if you are using MVC you could just put it into an actionfilter. You still need to take the dependency but it will at least be a lot cleaner way of invoking it:

public class PreventNewRelic : ActionFilterAttribute
{
    public override void OnActionExecuting(HttpActionContext actionContext)
    {
        NewRelic.Api.Agent.NewRelic.IgnoreTransaction();
        base.OnActionExecuting(actionContext);
    }
}
Wey answered 20/5, 2014 at 14:1 Comment(0)
H
0

If that works by your including NewRelic javascript in your pages, then you can simply not include it on those admin pages.

Hollenbeck answered 3/2, 2012 at 18:0 Comment(5)
I believe NewRelic is more low-level. I think it even instruments the assemblies.Ciao
It does instrument assemblies, as well as add JS to your pages to instrument time spent in the user's browser. Also has a free (Lite) version.Minneapolis
It is more low level, it's not Google Analytics. It uses javascript to calculate End User load time, but that javascript is inserted by the NewRelic agent and not controlled via code (unless if using the API).Popper
Hari, you really have to try it before you knock it. Or just sample the twitter feed for the keyword newrelic and see what people say about it.Biogen
Thanks; I'll do some research.Hollenbeck

© 2022 - 2024 — McMap. All rights reserved.