Created
April 22, 2015 07:16
-
-
Save abergs/726465559617333ea1a5 to your computer and use it in GitHub Desktop.
Ignore SignalR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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