Norr.PerformanceMonitor.Benchmarks 1.0.2

dotnet add package Norr.PerformanceMonitor.Benchmarks --version 1.0.2
                    
NuGet\Install-Package Norr.PerformanceMonitor.Benchmarks -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Norr.PerformanceMonitor.Benchmarks" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Norr.PerformanceMonitor.Benchmarks" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Norr.PerformanceMonitor.Benchmarks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Norr.PerformanceMonitor.Benchmarks --version 1.0.2
                    
#r "nuget: Norr.PerformanceMonitor.Benchmarks, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Norr.PerformanceMonitor.Benchmarks@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Norr.PerformanceMonitor.Benchmarks&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Norr.PerformanceMonitor.Benchmarks&version=1.0.2
                    
Install as a Cake Tool

Norr.PerformanceMonitor is a library that can be easily integrated into ASP.NET Core applications to collect performance metrics and export them to systems like Prometheus.

1. Installation

Install via NuGet:

dotnet add package Norr.PerformanceMonitor

This package includes the core performance measurement infrastructure, metric collectors (Monitor, PerformanceScope), and basic exporters.

2. Program.cs Integration (Minimal Example)

Add the following integration to your Program.cs file in your ASP.NET Core application:

using Microsoft.AspNetCore.Routing;
using Norr.PerformanceMonitor.Abstractions;
using Norr.PerformanceMonitor.DependencyInjection;
using Norr.PerformanceMonitor.Integrations.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddPerformanceMonitor();
builder.Services.AddControllers();

var app = builder.Build();

app.UseRouting();
app.UseRouteTagging();
app.UseMiddleware<PerformanceMiddleware>();

app.Use(async (ctx, next) =>
{
    var monitor = ctx.RequestServices.GetRequiredService<IMonitor>();
    var route = (ctx.GetEndpoint() as RouteEndpoint)?.RoutePattern.RawText
                ?? ctx.Request.Path.Value ?? "/";
    using (monitor.Begin($"http {ctx.Request.Method} {route}"))
        await next();
});

app.MapControllers();
app.UseNorrPrometheusEndpoint("/metrics");

app.Run();

With this setup, your application will start exposing metrics in Prometheus format at the /metrics endpoint.

3. First Run and Metrics Check

Run the application:

dotnet run

Make a request to an endpoint:

curl https://xxxx:yyyy/orders/42/details

Then check the metrics:

curl https://xxxx:yyyy/metrics

Example output:

# TYPE http_GET_orders__id__details summary
http_GET_orders__id__details_count 5
http_GET_orders__id__details_sum 400

These values show the total number of calls and duration/memory measurements for the given endpoint.

4. Optional Configuration (appsettings.json)

Add PerformanceOptions to your appsettings.json:

{
  "PerformanceOptions": {
    "Metrics": {
      "Temporality": "Cumulative",
      "EnableDuplicateGuard": true
    },
    "Exporters": {
      "Console": true,
      "Prometheus": true
    },
    "Scrubbing": {
      "MaskSensitiveValues": true,
      "NormalizePaths": true,
      "Mask": "***",
      "DropBannedKeys": false,
      "BannedKeys": [ "user.email", "http.authorization" ]
    }
  }
}

And add this to your Program.cs:

builder.Services.Configure<PerformanceOptions>(
    builder.Configuration.GetSection("PerformanceOptions"));

With these settings:

  • Console exporter is enabled → prints a summary log at startup.
  • Prometheus exporter remains enabled.
  • Scrubbing masks sensitive data and normalizes path parameters.

5. Conclusion

With these steps, Norr.PerformanceMonitor is integrated into your project. The first metrics appear at the /metrics endpoint. Optional settings allow you to easily manage exporter and scrubbing behavior.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 116 8/20/2025