Table of Contents

Profiler for .NET

The .NET agent is the published Reignite profiler. It runs in-process, watches EventCounters and runtime metrics, and captures a trace or memory dump when a configured threshold is breached.

Requirements

  • A .NET or ASP.NET Core application supported by the package.
  • A Reignite account with an application, an environment and a profiler.
  • Network access from the application to the Reignite API and Azure Blob Storage.

Install

dotnet add package Reignite.Profiler.AspNetCore

The package is published on NuGet as Reignite.Profiler.AspNetCore. The public Profilers page links to the same package and to the NuGet guide.

Configure

Copy the configuration block from Configurations in the portal and add it to appsettings.json. The shape is:

{
  "Performance": {
    "Profiler": {
      "ApiKey": "<your-api-key>",
      "ConfigurationRefreshMins": 10,
      "DumpWaitMins": 720,
      "TraceWaitMins": 120,
      "CommonTraceProviders": {
        "Providers": [
          "System.Runtime:0:1:EventCounterIntervalSec=1",
          "Reignite.Profiler:0:1:EventCounterIntervalSec=1"
        ]
      }
    }
  }
}

The generated block also contains the EventSourceActions that decide when to collect. A representative action looks like this:

{
  "EventSource": "System.Runtime",
  "DisplayName": "cpu-usage",
  "Operator": ">",
  "Threshold": 80,
  "Trace": true,
  "TraceProfile": "cpu-sampling",
  "TraceTriggerType": "CPU",
  "Dump": true
}
Field Meaning
EventSource The provider that emits the counter.
DisplayName The counter to watch.
Operator / Threshold The comparison that fires the action.
Trace / TraceProfile Whether to capture a trace and which profile to use.
Dump Whether to capture a memory dump.
TraceTriggerType The category recorded with the trace (CPU, Locks, Jit, memory, and so on).
Cooldown Optional per-action delay before it can fire again.

Register the services

In Program.cs (or Startup.ConfigureServices for an older host):

builder.Services.AddProfiler(builder.Configuration);
builder.Services.AddProfilerBackgroundService();

AddProfiler binds the configuration; AddProfilerBackgroundService starts the monitoring and collection loop.

Event-counter interval

EventCounterIntervalSec is part of each provider string. Changing it changes what a threshold means. A counter named *-count reports the number of events in the interval, so doubling the interval roughly doubles the observed count. Re-tune the threshold when you change the interval.

Optional: Application Insights

If you also want the full set of event counters published to Application Insights, install the companion Reignite.ApplicationInsights package and follow its README. This is optional; the profiler does not require it.

Verify the integration

  1. Deploy the application with the profiler enabled.
  2. Trigger a workload that breaches one of the configured thresholds.
  3. Open the Reignite portal and confirm that a trace file appears for the application and environment.
  4. The trace starts in Ready and moves to Assigned / Downloaded as an analyst picks it up. See the trace file lifecycle.

Troubleshooting

Symptom Check
No trace appears The threshold was never breached, the interval changed without re-tuning, or the action has Trace/Dump set to false.
Authentication failure ApiKey, KeyID/Secret or Environment does not match the profiler in the portal.
Upload failure The application cannot reach Blob Storage, or the SAS URL has expired.
Agent appears idle ConfigurationRefreshMins has not elapsed since the last configuration change.
Package not found The package id is Reignite.Profiler.AspNetCore; check the NuGet source configured in the build.