Skip to content

Commit

Permalink
Add Profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Sep 10, 2024
1 parent 3ff2a7d commit e9ac4d9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
20 changes: 9 additions & 11 deletions MyApp/_pages/admin-ui-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,16 @@ namespace MyApp;

public class ConfigureProfiling : IHostingStartup
{
public void Configure(IWebHostBuilder builder)
{
builder.ConfigureAppHost(host => {
host.Plugins.AddIfDebug(new RequestLogsFeature {
EnableResponseTracking = true,
});

host.Plugins.AddIfDebug(new ProfilingFeature {
IncludeStackTrace = true,
});
public void Configure(IWebHostBuilder builder) => builder
.ConfigureServices((context, services) => {
if (context.HostingEnvironment.IsDevelopment())
{
services.AddPlugin(new ProfilingFeature
{
IncludeStackTrace = true,
});
}
});
}
}
```

Expand Down
33 changes: 22 additions & 11 deletions MyApp/_pages/admin-ui-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,32 @@ Which will add the [Modular Startup](/modular-startup) configuration to your Hos
```csharp
public class ConfigureProfiling : IHostingStartup
{
public void Configure(IWebHostBuilder builder)
{
builder.ConfigureAppHost(host => {
host.Plugins.AddIfDebug(new RequestLogsFeature {
EnableResponseTracking = true,
});

host.Plugins.AddIfDebug(new ProfilingFeature {
IncludeStackTrace = true,
});
public void Configure(IWebHostBuilder builder) => builder
.ConfigureServices((context, services) => {
if (context.HostingEnvironment.IsDevelopment())
{
services.AddPlugin(new ProfilingFeature
{
IncludeStackTrace = true,
});
}
});
}
}
```

Whilst Request Logs can be added with:

::: sh
x mix requestlogs
:::

Or if you prefer to store Request Logs in an SQLite database then use the following command:

::: sh
x mix sqlitelogs
:::


The default configuration looks at providing useful information during development, where the response request bodies are captured in the Request Logger and the StackTrace is captured on the important events where they can be useful.

### Configuration
Expand Down

0 comments on commit e9ac4d9

Please sign in to comment.