QuackAlert 1.1.0

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

Quackalert

QuackAlert is a lightweight monitoring and alert library for .NET applications, designed to capture HTTP 5xx errors and send real-time email notifications.

✨ Features

  • Automatic HTTP 5xx error capture
  • Simple configuration via Options Pattern
  • Comprehensive request tracking with duration, timestamp, and correlation IDs
  • Detailed exception information
  • Environment and performance metrics
  • Distributed tracing support with TraceId and ParentTraceId

📦 Installation

dotnet add package QuackAlert

Or via NuGet Package Manager:

Install-Package QuackAlert

🚀 Quick Start

{
  "QuackAlert": {
    "Enabled": true,
    "Environment": "Production",
    "Email": {
      "SmtpHost": "smtp.gmail.com",
      "SmtpPort": 587,
      "SmtpUser": "your-email@gmail.com",
      "SmtpPassword": "your-app-password",
      "From": "your-email@gmail.com",
      "To": "recipient@email.com",
      "EnableSsl": true
    }
  }
}

<code style="color: red">⚠️ In production environments, avoid storing sensitive email configuration values directly inappsettings.json. </code>

<code style="color: red">Prefer supplying these values through environment variables, for example <code style="color: green">QuackAlert__Email__SmtpPassword.</code></code>

<code style="color: red">Any values defined in appsettings.json will be automatically overridden when the corresponding environment variables are provided</code>

And in Program.cs:

using QuackAlert.Extensions;
using QuackAlert.Enums;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddQuackAlert(options =>
{
    builder.Configuration.GetSection("QuackAlert").Bind(options);
});

var app = builder.Build();

// Add middleware
app.UseQuackAlert();

app.Run();

2. Configuration from Code

using QuackAlert.Extensions;
using QuackAlert.Enums;

var builder = WebApplication.CreateBuilder(args);

// Add QuackAlert
builder.Services.AddQuackAlert(options =>
{
    options.Enabled = true;
    options.Environment = EnvironmentType.Production;
    
    options.Email.SmtpHost = "smtp.gmail.com";
    options.Email.SmtpPort = 587;
    options.Email.SmtpUser = "your-email@gmail.com";
    options.Email.SmtpPassword = "your-app-password";
    options.Email.From = "your-email@gmail.com";
    options.Email.To = "recipient@email.com";
    options.Email.EnableSsl = true;
});

var app = builder.Build();

// Add middleware
app.UseQuackAlert();

app.Run();

⚙️ Configuration

QuackAlertOptions

Property Type Default Description
Enabled bool true Enables or disables QuackAlert
Environment EnvironmentType Production Sets the environment (Development, Staging, Production)
Email EmailOptions - Email configuration settings

EmailOptions

Property Type Default Description
SmtpHost string "" SMTP server
SmtpPort int 587 SMTP port
SmtpUser string "" SMTP username
SmtpPassword string "" SMTP password
From string "" Sender email address
To string "" Recipient email address
EnableSsl bool true Enables SSL/TLS

Note: Email sending is only activated when Enabled = true AND Environment = Production.

📊 What Gets Captured

QuackAlert automatically monitors and captures comprehensive diagnostic information:

Request Information

  • ✅ HTTP method (GET, POST, etc.)
  • ✅ Request path and query string
  • ✅ Protocol version (HTTP/1.1, HTTP/2, etc.)
  • ✅ Scheme (http/https)
  • ✅ Host information
  • ✅ User-Agent
  • ✅ Content length

Response Information

  • ✅ HTTP status code
  • ✅ Response content length

Tracing & Correlation

  • ✅ TraceId for distributed tracing
  • ✅ CorrelationId for request tracking
  • ✅ ParentTraceId for nested operations

Performance Metrics

  • ✅ Request duration in milliseconds
  • ✅ Request timestamp

Exception Details

  • ✅ Exception type
  • ✅ Exception message
  • ✅ Full exception stack trace

Environment Information

  • ✅ Machine name
  • ✅ Application version

Email Example

When a 5xx error occurs, you'll receive a formatted HTML email containing:

{
  "StatusCode": 500,
  "TraceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
  "CorrelationId": "0HN4DKQ8F2MKL:00000001",
  "ParentTraceId": null,
  "Timestamp": "2024-12-20T10:30:45.123456Z",
  "Request": {
    "Path": {
      "Value": "/api/users",
      "HasValue": true
    },
    "Method": "POST",
    "Query": "?page=1&limit=10",
    "Protocol": "HTTP/2",
    "Scheme": "https",
    "Host": "api.example.com",
    "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    "ContentLength": 256
  },
  "Response": {
    "StatusCode": 500,
    "ContentLength": null
  },
  "Performance": {
    "DurationMs": 1250
  },
  "Environment": {
    "MachineName": "web-server-01",
    "Version": "1.0.0.0"
  },
  "Exception": {
    "Type": "NullReferenceException",
    "Message": "Object reference not set to an instance of an object"
  }
}

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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.1.0 99 1/7/2026
1.0.3 132 12/29/2025