Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More work on ASP.NET Core timings #482

Merged
merged 13 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/AspDotNetCore.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@ public void ConfigureServices(IServiceCollection services)
// (Optional) Use something other than the "light" color scheme.
// (defaults to "light")
options.ColorScheme = StackExchange.Profiling.ColorScheme.Auto;

// The below are newer options, available in .NET Core 3.0 and above:

// (Optional) You can disable MVC filter profiling
// (defaults to true, and filters are profiled)
options.EnableMvcFilterProfiling = true;
// ...or only save filters that take over a certain millisecond duration (including their children)
// (defaults to null, and all filters are profiled)
// options.MvcFilterMinimumSaveMs = 1.0m;

// (Optional) You can disable MVC view profiling
// (defaults to true, and views are profiled)
options.EnableMvcFilterProfiling = true;
// ...or only save views that take over a certain millisecond duration (including their children)
// (defaults to null, and all views are profiled)
// options.MvcViewMinimumSaveMs = 1.0m;

// (Optional - not recommended) You can enable a heavy debug mode with stacks and tooltips when using memory storage
// It has a lot of overhead vs. normal profiling and should only be used with that in mind
// (defaults to false, debug/heavy mode is off)
//options.EnableDebugMode = true;
});
}
```
Expand Down
4 changes: 3 additions & 1 deletion docs/Releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ This page tracks major changes included in any update starting with version 4.0.
- Added dark and "auto" (system preference decides) color themes, total is "Light", "Dark", and "Auto" ([#451](https://github.com/MiniProfiler/dotnet/pull/451))
- Generally moves to CSS 3 variables, for easier custom themes as well ([#451](https://github.com/MiniProfiler/dotnet/pull/451))
- Added `SqlServerFormatter.IncludeParameterValues` for excluding actual values in output if desired ([#463](https://github.com/MiniProfiler/dotnet/pull/463))
- New "debug" mode (via `.EnableDebugMode`) that outputs stack dumps for every timing (expensive/heavy, and not intended for normal operation - [#482](https://github.com/MiniProfiler/dotnet/pull/482))
- (**.NET Core only**) Added `MiniProfilerOptions.ResultsAuthorizeAsync` and `MiniProfiler.ResultsAuthorizeListAsync` ([#472](https://github.com/MiniProfiler/dotnet/pull/472))
- (**.NET Core only**) Added profiling to all diagnostic events (views, filters, etc. - [#475](https://github.com/MiniProfiler/dotnet/pull/475))
- (**.NET Core only**) Added profiling to all diagnostic events (views, filters, etc. - [#475](https://github.com/MiniProfiler/dotnet/pull/475) & [#482](https://github.com/MiniProfiler/dotnet/pull/482))
- New options around this are in the ASP.NET Core docs on the left.
- **Fixes/Changes**:
- Fix for ['i.Started.toUTCString is not a function'](https://github.com/MiniProfiler/dotnet/pull/462) when global serializer options are changed.
- Removed jQuery (built-in) dependency ([#442](https://github.com/MiniProfiler/dotnet/pull/442))
Expand Down
4 changes: 4 additions & 0 deletions samples/Samples.AspNetCore3/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

namespace Samples.AspNetCore.Controllers
{
[ExampleActionFilter]
public class HomeController : Controller
{
[ExampleLongActionFilter]
//[ExampleActionFilter]
[ExampleAsyncActionFilter]
public IActionResult Index()
{
using (MiniProfiler.Current.Step("Example Step"))
Expand Down
27 changes: 27 additions & 0 deletions samples/Samples.AspNetCore3/Helpers/ExampleActionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Samples.AspNetCore
{
public class ExampleActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context) => Thread.Sleep(100);
}

public class ExampleLongActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context) => Thread.Sleep(200);
}

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
public class ExampleAsyncActionFilterAttribute : Attribute, IAsyncActionFilter
{
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
await Task.Delay(300);
await next();
}
}
}
14 changes: 14 additions & 0 deletions samples/Samples.AspNetCore3/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public void ConfigureServices(IServiceCollection services)
// Enabled sending the Server-Timing header on responses
options.EnableServerTimingHeader = true;

// Optionally disable MVC filter profiling
//options.EnableMvcFilterProfiling = false;
// Or only save filters that take over a certain millisecond duration (including their children)
//options.MvcFilterMinimumSaveMs = 1.0m;

// Optionally disable MVC view profiling
//options.EnableMvcFilterProfiling = false;
// Or only save views that take over a certain millisecond duration (including their children)
//options.MvcViewMinimumSaveMs = 1.0m;

// This enables debug mode with stacks and tooltips when using memory storage
// It has a lot of overhead vs. normal profiling and should only be used with that in mind
//options.EnableDebugMode = true;

options.IgnoredPaths.Add("/lib");
options.IgnoredPaths.Add("/css");
options.IgnoredPaths.Add("/js");
Expand Down
2 changes: 1 addition & 1 deletion samples/Samples.AspNetCore3/web.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00" hostingModel="InProcess" arguments="%LAUNCHER_ARGS%">
<aspNetCore processPath="%LAUNCHER_PATH%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00" hostingModel="InProcess">
<environmentVariables>
<environmentVariable name="COMPLUS_ForceENC" value="1" />
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
Expand Down
Loading