AvaranFlow.Core 1.0.0

dotnet add package AvaranFlow.Core --version 1.0.0
                    
NuGet\Install-Package AvaranFlow.Core -Version 1.0.0
                    
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="AvaranFlow.Core" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AvaranFlow.Core" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AvaranFlow.Core" />
                    
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 AvaranFlow.Core --version 1.0.0
                    
#r "nuget: AvaranFlow.Core, 1.0.0"
                    
#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 AvaranFlow.Core@1.0.0
                    
#: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=AvaranFlow.Core&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AvaranFlow.Core&version=1.0.0
                    
Install as a Cake Tool

AvaranFlow

Resilient exception processing, storm deduplication, and policy-driven alerting infrastructure for .NET.

Target License: MIT NuGet

Repository: GitHub · NuGet: AvaranFlow.Core · AvaranFlow.Alerting.Core · AvaranFlow.NLog · Documentation: Project Site · Common Questions · AI Summary: llms.txt · Full AI Reference · Package Icon: 128×128 PNG · Vector Icon: SVG


AvaranFlow Social Preview


Overview

When software fails under production load, a cascade of dependent components often triggers an overwhelming storm of identical or related exceptions. Standard logging frameworks (e.g. Serilog, NLog, or log4net) write each occurrence individually to disk or database tables, quickly exhausting disk space, saturating I/O pipelines, locking database tables, and blinding monitoring teams with noisy telemetry.

AvaranFlow (formerly ExceptionMaster) provides a dedicated, high-performance protective layer between runtime failures and downstream logging or notification sinks:

  1. At the Capture Gate: It sanitizes, normalizes, and groups duplicate exceptions in-memory using atomic Compare-And-Swap (CAS) state machines.
  2. In the Buffer: It absorbs traffic spikes in a strictly bounded in-memory queue with configurable overflow policies (DropOldest, DropNewest, BlockWithTimeout).
  3. In the Policy Engine: It dynamically resolves alert severity, enforces rule-scoped suppression (cooldowns, rate limits), tracks escalation thresholds, and dispatches sanitized alert envelopes to registered destination groups and fallback cascades.
  4. Failure Isolation: Sinks, destinations, or rule evaluation errors never escape or crash the host application.

Choosing an Exception & Alerting Solution

Capability Raw Serilog / NLog Application Insights / Sentry Polly AvaranFlow
Primary Focus General-purpose logging sink targets Cloud APM / Error Aggregation SaaS Transient fault handling & retry policies In-Process Failure Containment, Deduplication & Policy Alerting
Exception Storm Control None (Writes every line directly to I/O) Server-side rate limits & sampling None (Retries fail or bubble up) In-memory lock-free atomic CAS deduplication before I/O
Bounded Buffer Policies Unbounded queue or synchronous I/O Network batching buffer Not applicable Bounded queue with DropOldest, DropNewest, BlockWithTimeout
Rule-Scoped Suppression & Escalation Requires custom log filters Cloud alert rules & alerts Not applicable Rule-scoped sliding windows, cooldowns, and threshold escalation
Vendor / Cloud Lock-In None Vendor / Cloud subscription None Zero Cloud Lock-In (Pure open-source in-process .NET)
Failure Containment Sinks can throw or exhaust threads Network latency / API timeouts Catches transient exceptions only Guaranteed zero exception leakage to caller threads

Architecture Overview

flowchart TD
    subgraph Host ["Host Application Execution"]
        App["Application Threads"]
        CatchBlock["catch (Exception ex)"]
    end

    subgraph AvaranFlowCore ["AvaranFlow.Core (Ingestion & Containment)"]
        Facade["AvaranFlow.Log(ex)"]
        Enricher["Context Enrichment\n(Machine, Process, Thread, Stack Sanitizer)"]
        Aggregator["Atomic CAS Aggregator\n(Normalization & Storm Deduplication)"]
        Buffer["Bounded In-Memory Dispatch Queue\n(DropOldest / DropNewest / BlockWithTimeout)"]
        SinkFanOut["Sink Coordinator & Fallback Chain"]
    end

    subgraph AlertingEngine ["AvaranFlow.Alerting.Core (Policy Engine)"]
        SeverityResolver["Dynamic Severity Resolver\n(Warning, Error, Critical)"]
        RuleEngine["Deterministic Rule Engine\n(Ascending Order, All-Match)"]
        Suppression["Rule-Scoped Suppression\n(Cooldown, Sliding Window)"]
        Escalation["Rule-Scoped Escalation\n(Threshold Promotion)"]
        EnvelopeBoundary["Safe AlertEnvelope Boundary\n(Zero Raw Exception Leakage)"]
    end

    subgraph Sinks ["Destinations & Presentation"]
        ConsoleSink["Console Sink (Colorized)"]
        FileSink["Rolling File Sink"]
        DbSink["SQL Server Sink"]
        NLogSink["NLog Adapter"]
        SangamLinkDest["SangamLink (Desktop UI Adapter)"]
        FallbackSinks["Fallback Cascades"]
    end

    App --> CatchBlock
    CatchBlock --> Facade
    Facade --> Enricher
    Enricher --> Aggregator
    Aggregator --> Buffer
    Buffer --> SinkFanOut
    SinkFanOut --> ConsoleSink
    SinkFanOut --> FileSink
    SinkFanOut --> DbSink
    SinkFanOut --> NLogSink

    Buffer -.-> SeverityResolver
    SeverityResolver --> RuleEngine
    RuleEngine --> Suppression
    Suppression --> Escalation
    Escalation --> EnvelopeBoundary
    EnvelopeBoundary --> SangamLinkDest
    EnvelopeBoundary --> FallbackSinks

Supported Frameworks

Package Assembly Target Frameworks Compatibility
AvaranFlow.Core AvaranFlow.Core.dll net461, netstandard2.0 .NET Core 2.0+, .NET 5/6/7/8/9+, .NET Framework 4.6.1+
AvaranFlow.Alerting.Core AvaranFlow.Alerting.Core.dll netstandard2.0, net8.0 .NET 8.0+, .NET Framework 4.8+, .NET Standard 2.0
AvaranFlow.Sinks.Console AvaranFlow.Sinks.Console.dll net461, netstandard2.0 All supported .NET runtimes
AvaranFlow.Sinks.File AvaranFlow.Sinks.File.dll net461, netstandard2.0 All supported .NET runtimes
AvaranFlow.Sinks.Database AvaranFlow.Sinks.Database.dll net461, netstandard2.0 Microsoft SQL Server / Azure SQL
AvaranFlow.NLog AvaranFlow.NLog.dll net461, netstandard2.0 NLog 4.7.15+ integrations

Installation

Install via the .NET CLI:

# Core exception processing and buffering framework:
dotnet add package AvaranFlow.Core --version 1.0.0

# Optional headless alerting policy and routing engine:
dotnet add package AvaranFlow.Alerting.Core --version 1.0.0

# Optional first-party sinks:
dotnet add package AvaranFlow.Sinks.Console --version 1.0.0
dotnet add package AvaranFlow.Sinks.File --version 1.0.0
dotnet add package AvaranFlow.Sinks.Database --version 1.0.0
dotnet add package AvaranFlow.NLog --version 1.0.0

Quick Start

1. Basic Ingestion & Failure Containment

Configure AvaranFlow once at application startup:

using AvaranFlow.Core;
using AvaranFlow.Sinks.Console;
using AvaranFlow.Sinks.File;
using System;

// Configure in-memory buffering, aggregation window, and sinks
var options = AvaranFlowOptions.CreateDefault();
options.EnableAsyncDispatch = true;
options.BufferCapacity = 5000;
options.OverflowPolicy = QueueOverflowPolicy.DropOldest;
options.AggregationWindow = TimeSpan.FromMinutes(1);

// Register sinks with automatic fallback
options.RegisterSink(new ConsoleSink());
options.RegisterSink(new FileSink("logs/exceptions.log", maxFileSizeMb: 20));

AvaranFlow.Core.ExceptionMaster.Configure(options);

// Capture exceptions anywhere in your application:
try
{
    ExecuteHighFrequencyOrder();
}
catch (Exception ex)
{
    // Thread-safe, non-blocking, storm-deduplicated logging
    AvaranFlow.Core.ExceptionMaster.Log(ex);
}

2. Headless Alerting Pipeline with Suppression & Escalation

using AvaranFlow.Alerting;
using AvaranFlow.Alerting.Configuration;
using AvaranFlow.Alerting.Enums;
using AvaranFlow.Alerting.Models;
using AvaranFlow.Alerting.Rules;
using AvaranFlow.Alerting.Suppression;
using System;

Alerting.Initialize(builder =>
{
    // Configure bounded pipeline queue and concurrency
    builder.WithBoundedQueue(capacity: 5000, overflowPolicy: QueueOverflowPolicy.DropNewest)
           .WithConcurrency(workerConcurrency: 2, globalMaxDestinationConcurrency: 16);

    // Register a 5-minute cooldown suppression policy per exception key
    builder.RegisterSuppressionPolicy(new SuppressionPolicy(
        policyId: "cooldown-5m",
        dimension: SuppressionDimension.ExceptionKey,
        duration: TimeSpan.FromMinutes(5)));

    // Register an alert rule
    builder.AddRule(new AlertRule(
        ruleId: "critical-rule",
        name: "Critical Exception Rule",
        condition: RuleCondition.Severity(PredicateOperator.GreaterThanOrEqual, AlertSeverity.Critical),
        order: 10,
        targetDestinations: new[] { "ConsoleDestination" },
        suppressionPolicyId: "cooldown-5m"));
});

// Non-destructive queue flushing before checkpoints
await Alerting.FlushAsync(TimeSpan.FromSeconds(5));

// Graceful drain on application shutdown
await Alerting.ShutdownAsync(TimeSpan.FromSeconds(10));

Performance & Allocations

Benchmarks measured via BenchmarkDotNet in Release mode (.NET 8.0):

Operation Ingested Count Elapsed Time Latency / Op Allocation / Op
Log() Repeated CAS Update 10,000 12.4 ms 1.24 µs 0 B (Zero-Alloc)
Log() Unaggregated Ingress 10,000 28.1 ms 2.81 µs Minimal (Bounded QueueItem)
Alerting Rule Evaluation 10,000 14.6 ms 1.46 µs Minimal
Queue Overflow (DropOldest) 50,000 45.2 ms 0.90 µs 0 B

Run the benchmarks locally:

dotnet run --project benchmarks/AvaranFlow.Benchmarks/AvaranFlow.Benchmarks.csproj -c Release

Delivery Semantics & Guarantees

  1. Failure Isolation: Sinks, destinations, or rule evaluation errors never escape or crash the host application thread.
  2. At-Least-Once Buffer / Best-Effort Destinations: Successful destination delivery confirms acceptance into the destination's ingress queue; it does not guarantee downstream receipt.
  3. Volatile Process Memory: Buffered queues and unpersisted aggregation counters reside in process RAM. Abrupt termination (Process.Kill(), power failure) loses un-flushed items (use synchronous dispatch or FlushAsync before shutdown).

Documentation Index


Contributing

Contributions are welcome! Please read our Contributing Guidelines and review the Code of Conduct before submitting pull requests.


License

This project is licensed under the MIT License.
Copyright (c) 2026 Hitesh Bhanushali.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on AvaranFlow.Core:

Package Downloads
AvaranFlow.Alerting.Core

Policy-driven routing, dynamic severity resolution, suppression, escalation, and destination fan-out infrastructure for AvaranFlow.

AvaranFlow.NLog

Optional NLog adapter for AvaranFlow without altering host configuration or dependencies.

AvaranFlow.Sinks.Database

Parameterized SQL Server database sink for AvaranFlow with batched upsert and retry recovery.

AvaranFlow.Sinks.File

Size-rotated, resilient file sink for AvaranFlow with archive retention management.

AvaranFlow.Sinks.Console

Safe, failure-contained console sink for AvaranFlow with colorized formatting.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 247 11/3/2026