We just started using NewRelic at work and I’ve really been digging it. We also use SignalR which (by design) can use long-polling connections. Unfortunately, those tend connections to skew the metrics in NewRelic. Fortunately, NewRelic provides an API to ignore certain transactions, so I thought I’d be able to tell it to just ignore signalr.

At first, I tried this answer on StackOverflow, but it ended up ignoring all requests, not just the ones for SignalR. In the end I had to use an Owin module to get the job done.

Here is the code I ended up with

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using AppFunc = Func<IDictionary<string,object>, 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) {

		return _nextAppFunc(environment);

To use this in your owin startup code call the following