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
<PackageReference Include="Norr.PerformanceMonitor.Benchmarks" Version="1.0.2" />
<PackageVersion Include="Norr.PerformanceMonitor.Benchmarks" Version="1.0.2" />
<PackageReference Include="Norr.PerformanceMonitor.Benchmarks" />
paket add Norr.PerformanceMonitor.Benchmarks --version 1.0.2
#r "nuget: Norr.PerformanceMonitor.Benchmarks, 1.0.2"
#:package Norr.PerformanceMonitor.Benchmarks@1.0.2
#addin nuget:?package=Norr.PerformanceMonitor.Benchmarks&version=1.0.2
#tool nuget:?package=Norr.PerformanceMonitor.Benchmarks&version=1.0.2
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 | Versions 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. |
-
net9.0
- BenchmarkDotNet (>= 0.15.2)
- MassTransit (>= 8.5.2)
- MediatR (>= 13.0.0)
- Microsoft.CodeAnalysis.Common (>= 4.14.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Microsoft.Diagnostics.Runtime (>= 3.1.512801)
- Microsoft.Diagnostics.Tracing.TraceEvent (>= 3.1.23)
- Microsoft.EntityFrameworkCore (>= 9.0.8)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.8)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Caching.Memory (>= 9.0.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Http (>= 9.0.8)
- Microsoft.Extensions.Logging (>= 9.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Options (>= 9.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.8)
- Norr.PerformanceMonitor (>= 1.0.2)
- Norr.PerformanceMonitor.Attribution (>= 1.0.2)
- Norr.PerformanceMonitor.OpenTelemetry (>= 1.0.2)
- OpenTelemetry (>= 1.12.0)
- OpenTelemetry.Api (>= 1.12.0)
- OpenTelemetry.Extensions.Hosting (>= 1.12.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.12.0)
- OpenTelemetry.Instrumentation.Http (>= 1.12.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.12.0)
- Polly (>= 8.6.2)
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 |