Configuration

Customise how Blazrlytics tracks and logs your application's components and lifecycle events.

Method 1: Using TraceOptions Object

You can configure Blazrlytics programmatically when registering the service in your Program.cs. This is useful when you need dynamic configuration or prefer keeping settings in code.

builder.Services.AddBlazrlytics(options =>
{
    options.Enabled = true;
    options.ShowDashboardIcon = false;
    options.PerformanceThresholdMicroSeconds = 5000;
    options.ExcludeNamespaces = ["Microsoft.AspNetCore.Components"];
    options.ExcludeEvents = [Event.OnAfterRender, Event.OnAfterRenderAsync];
});

Method 2: Using appsettings.json

Alternatively, you can bind your configuration from appsettings.json. This is recommended for environment-specific settings.

{
  "Blazrlytics": {
    "Enabled": true,
    "ShowDashboardIcon": true,
    "PerformanceThresholdMicroSeconds": 0,
    "ExcludeComponentNames": ["MyNoisyComponent"],
    "ExcludeEvents": ["OnAfterRender"]
  }
}

Then, in your Program.cs, bind the section:

builder.Services.AddBlazrlytics(builder.Configuration, "Blazrlytics");

TraceOptions Reference

Below are all the available options you can use to customise Blazrlytics.

Property Default Description
Enabled true Enable or disable Blazrlytics globally.
ShowDashboardIcon true Show the floating dashboard icon. Note that if you do not show the floating icon you can use Ctrl+F12 to open or close the dashboard.
IncludeStackTrace true Include stack traces in logs to help pinpoint renders.
MaxStackTraceLength 1000 Limit stack trace length to reduce log size and noise.
ShowUnchangedParametersInDiff true Show parameter values for SetParametersAsync even when they haven't changed.
ExcludeNamespaces [] List of namespaces to exclude from being tracked.
ExcludeEvents [] List of specific lifecycle events to ignore globally.
PerformanceThresholdMicroSeconds 0 Minimum duration in microseconds to log an event. 0 logs all events.
LogToConsole false Whether to output trace events directly to the browser/server console.
EnableComponentHighlighting true Include a hidden wrapper in the DOM to enable visual component highlighting.
ExcludeComponentNames [] List of component names (short or full) to completely exclude from tracing.
An unhandled error has occurred. Reload 🗙