AvaranFlow.Sinks.Database
1.0.0
dotnet add package AvaranFlow.Sinks.Database --version 1.0.0
NuGet\Install-Package AvaranFlow.Sinks.Database -Version 1.0.0
<PackageReference Include="AvaranFlow.Sinks.Database" Version="1.0.0" />
<PackageVersion Include="AvaranFlow.Sinks.Database" Version="1.0.0" />
<PackageReference Include="AvaranFlow.Sinks.Database" />
paket add AvaranFlow.Sinks.Database --version 1.0.0
#r "nuget: AvaranFlow.Sinks.Database, 1.0.0"
#:package AvaranFlow.Sinks.Database@1.0.0
#addin nuget:?package=AvaranFlow.Sinks.Database&version=1.0.0
#tool nuget:?package=AvaranFlow.Sinks.Database&version=1.0.0
AvaranFlow
Resilient exception processing, storm deduplication, and policy-driven alerting infrastructure for .NET.
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
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:
- At the Capture Gate: It sanitizes, normalizes, and groups duplicate exceptions in-memory using atomic Compare-And-Swap (CAS) state machines.
- In the Buffer: It absorbs traffic spikes in a strictly bounded in-memory queue with configurable overflow policies (
DropOldest,DropNewest,BlockWithTimeout). - 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.
- 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
- Failure Isolation: Sinks, destinations, or rule evaluation errors never escape or crash the host application thread.
- At-Least-Once Buffer / Best-Effort Destinations: Successful destination delivery confirms acceptance into the destination's ingress queue; it does not guarantee downstream receipt.
- 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 orFlushAsyncbefore shutdown).
Documentation Index
- Architecture Guide
- API Reference
- Configuration Reference
- Database Sink Schema
- Fallback & Fan-Out Routing
- Performance & Latency Guide
- Test Plan & Verification Traceability
- AI Summary Reference (llms.txt)
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 | Versions 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. |
-
.NETFramework 4.6.1
- AvaranFlow.Core (>= 1.0.0)
-
.NETStandard 2.0
- AvaranFlow.Core (>= 1.0.0)
- System.Data.SqlClient (>= 4.8.6)
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.0 | 96 | 11/3/2026 |