Fix mini profiler so that it actually profiles the Content APIs in the back office
This commit is contained in:
@@ -26,12 +26,16 @@ namespace Umbraco.Web.Logging
|
|||||||
_provider = new WebProfilerProvider();
|
_provider = new WebProfilerProvider();
|
||||||
|
|
||||||
//see https://miniprofiler.com/dotnet/AspDotNet
|
//see https://miniprofiler.com/dotnet/AspDotNet
|
||||||
MiniProfiler.Configure(new MiniProfilerOptions
|
var options = new MiniProfilerOptions
|
||||||
{
|
{
|
||||||
SqlFormatter = new SqlServerFormatter(),
|
SqlFormatter = new SqlServerFormatter(),
|
||||||
StackMaxLength = 5000,
|
StackMaxLength = 5000,
|
||||||
ProfilerProvider = _provider
|
ProfilerProvider = _provider
|
||||||
});
|
};
|
||||||
|
// this is a default path and by default it performs a 'contains' check which will match our content controller
|
||||||
|
// (and probably other requests) and ignore them.
|
||||||
|
options.IgnoredPaths.Remove("/content/");
|
||||||
|
MiniProfiler.Configure(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UmbracoApplicationBeginRequest(object sender, EventArgs e)
|
public void UmbracoApplicationBeginRequest(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -85,7 +85,11 @@ namespace Umbraco.Web.Logging
|
|||||||
public override MiniProfiler Start(string profilerName, MiniProfilerBaseOptions options)
|
public override MiniProfiler Start(string profilerName, MiniProfilerBaseOptions options)
|
||||||
{
|
{
|
||||||
var first = Interlocked.Exchange(ref _first, 1) == 0;
|
var first = Interlocked.Exchange(ref _first, 1) == 0;
|
||||||
if (first == false) return base.Start(profilerName, options);
|
if (first == false)
|
||||||
|
{
|
||||||
|
var profiler = base.Start(profilerName, options);
|
||||||
|
return profiler;
|
||||||
|
}
|
||||||
|
|
||||||
_startupProfiler = new MiniProfiler("StartupProfiler", options);
|
_startupProfiler = new MiniProfiler("StartupProfiler", options);
|
||||||
CurrentProfiler = _startupProfiler;
|
CurrentProfiler = _startupProfiler;
|
||||||
|
|||||||
Reference in New Issue
Block a user