Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Breakdown ASP.NET Core Middleware Times



.NET Agent Question Template


Agent Version: 8.9.130

  • Are you using .NET framework or .NET Core? Core

  • Please let us know which operating system you have questions about: Linux

Seeing errors?

  • Add the error text, or a screenshot of the error and tell us where it came from: No errors


  • Describe what you are seeing: I am seeing a rather large block of time listed as “Middleware Pipeline”

  • How does that differ from what you are expecting to see? A breakdown of each piece of the middleware pipeline. I have several pieces of custom middleware and I would like to see a breakdown of each piece of the pipeline. Should I be using NewRelic.Api.Agent.NewRelic.RecordResponseTimeMetric to break down each piece of my middleware or can I configure the agent to do it automatically?


@pete5 -

The .NET agent won’t automatically instrument your custom middleware. It only knows about WebAPI/MVC.

You’ll want to add custom instrumentation to monitor your components. Two separate methods for doing so are described here and here. You can use either method.

You don’t want to use NewRelic.Api.Agent.NewRelic.RecordResponseTimeMetric.

I hope that helps.


Using [Trace] on my middleware InvokeAsync methods worked perfectly. Thanks!