Skip to content

Instantly share code, notes, and snippets.

@abergs
Created April 22, 2015 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abergs/726465559617333ea1a5 to your computer and use it in GitHub Desktop.
Save abergs/726465559617333ea1a5 to your computer and use it in GitHub Desktop.
Ignore SignalR
using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>;
public class NewRelicIgnoreTransactionOwinModule
{
private AppFunc _nextAppFunc;
public NewRelicIgnoreTransactionOwinModule(AppFunc nextAppFunc)
{
_nextAppFunc = nextAppFunc;
}
public Task Invoke(IDictionary<string, object> environment)
{
object request = null;
if (environment.TryGetValue("owin.RequestPath", out request))
{
if (((string)request).IndexOf("signalr", StringComparison.OrdinalIgnoreCase) > -1)
{
NewRelic.Api.Agent.NewRelic.IgnoreTransaction();
}
}
return _nextAppFunc(environment);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment