Norr.PerformanceMonitor 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Norr.PerformanceMonitor --version 1.0.1
                    
NuGet\Install-Package Norr.PerformanceMonitor -Version 1.0.1
                    
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" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Norr.PerformanceMonitor" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Norr.PerformanceMonitor" />
                    
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 --version 1.0.1
                    
#r "nuget: Norr.PerformanceMonitor, 1.0.1"
                    
#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@1.0.1
                    
#: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&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Norr.PerformanceMonitor&version=1.0.1
                    
Install as a Cake Tool

Norr.PerformanceMonitor

Advanced performance monitoring library for .NET with OpenTelemetry, threshold-based alerting, and flamegraph profiling support.
πŸ“¦ NuGet Package
πŸ”— GitHub Repository


πŸš€ Overview

Norr.PerformanceMonitor is a lightweight and extensible monitoring toolkit designed for production-grade .NET applications.

It captures:

  • ⏱️ Execution time
  • πŸ”₯ CPU usage
  • 🧠 Memory allocations
    …and exports them to console, Prometheus, OTLP, or any alerting destination.

✨ Key Features

  • ⚑ Low-overhead performance tracking
  • 🧡 using-based measurement scopes
  • 🎯 Attribute-based source generation: Norr.PerformanceMonitor.Attribution
  • 🧠 Sampling & deduplication logic (bloom filter)
  • 🚨 Slack / webhook alerting on thresholds
  • πŸ“Š Flamegraph generation (.speedscope.json)
  • 🧩 Ready-to-use integrations: ASP.NET Core, MassTransit, MediatR, BackgroundService

πŸ“¦ Installation

dotnet add package Norr.PerformanceMonitor

Register the library in your DI container:

services.AddPerformanceMonitoring(o =>
{
    o.Sampling.Probability = 0.1;
    o.Alerts.DurationMs    = 500;
    o.Exporters            = ExporterFlags.Console | ExporterFlags.Prometheus;
});

ASP.NET Core middleware:

app.UsePerformanceMonitoring();

⚑ Quick Start

πŸ§ͺ Measure any method

[MeasurePerformance]
public void DoWork()
{
    Thread.Sleep(200);
}

πŸ’‘ Requires installing Norr.PerformanceMonitor.Attribution


πŸ” Monitor background workers

public sealed class MyWorker : BackgroundServiceWrapper
{
    public MyWorker(IMonitor m) : base(m) { }

    protected override async Task ExecuteCoreAsync(CancellationToken stop)
    {
        while (!stop.IsCancellationRequested)
            await Task.Delay(1000, stop);
    }
}

πŸ“¬ MediatR + MassTransit integration

services.AddTransient(typeof(IPipelineBehavior<,>), typeof(PerformanceBehavior<,>));
cfg.UseConsumeFilter(typeof(PerformanceFilter<>), provider);

πŸ”₯ Flamegraph Export

await using var rec = FlamegraphRecorder.Start("hot.speedscope.json");
DoHotStuff();

Then open the file at speedscope.app


βš™οΈ Configuration Reference

Option Description
SamplingOptions.Probability Percentage of operations to sample (0.0 - 1.0)
AlertOptions.DurationMs Alert threshold for wall-clock duration (ms)
AlertOptions.AllocBytes Alert threshold for memory allocation (bytes)
ExporterFlags Console, InMemory, Prometheus, OTLP support
DuplicateGuardOptions Bloom filter size and cooldown (anti-spam)

❀️ Credits

Built and maintained by @berkayhuz
Part of the Norr .NET ecosystem
Licensed under MIT

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 (1)

Showing the top 1 NuGet packages that depend on Norr.PerformanceMonitor:

Package Downloads
Norr.PerformanceMonitor.Benchmarks

Modular, production-grade .NET libraries by Norr. Clean Architecture, zero-bloat.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 129 8/20/2025
1.0.1 440 7/24/2025
1.0.0 441 7/24/2025