diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..ad5a8b7
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,38 @@
+name: CI
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '8.0.x'
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --configuration Release --no-restore
+
+ - name: Test
+ run: dotnet test --configuration Release --no-build --verbosity normal
+
+ - name: Pack (verify)
+ run: dotnet pack CpuGuard.NET/CpuGuard.NET.csproj --configuration Release --no-build --output ./artifacts
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: nuget-package
+ path: ./artifacts/*.nupkg
+ retention-days: 7
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..c7e5dc8
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,45 @@
+name: Release to NuGet
+
+on:
+ push:
+ tags:
+ - 'v*.*.*'
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '8.0.x'
+
+ - name: Extract version from tag
+ id: get_version
+ run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --configuration Release --no-restore
+
+ - name: Test
+ run: dotnet test --configuration Release --no-build --verbosity normal
+
+ - name: Pack
+ run: dotnet pack CpuGuard.NET/CpuGuard.NET.csproj --configuration Release --no-build -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output ./artifacts
+
+ - name: Push to NuGet
+ run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
+
+ - name: Create GitHub Release
+ uses: softprops/action-gh-release@v1
+ with:
+ files: ./artifacts/*.nupkg
+ generate_release_notes: true
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/CpuGuard.NET/CpuGuard.NET.csproj b/CpuGuard.NET/CpuGuard.NET.csproj
index 37af201..d78f479 100644
--- a/CpuGuard.NET/CpuGuard.NET.csproj
+++ b/CpuGuard.NET/CpuGuard.NET.csproj
@@ -4,13 +4,19 @@
netstandard2.1
enable
2.0.0
+ $(Version)
Khaled Md Tuhidul Hossain
EncryptedTouhid
Comprehensive resource management middleware for ASP.NET Core applications. Features include CPU and memory limiting, gradual throttling, rate limiting, health checks, OpenTelemetry metrics, and a real-time dashboard.
cpu limit middleware aspnetcore throttling performance memory rate-limiting health-check opentelemetry dashboard
https://github.com/encryptedtouhid/CpuGuard.NET
- LICENSE
+ git
+ https://github.com/encryptedtouhid/CpuGuard.NET
+ LICENSE.md
README.md
+ false
+ true
+ snupkg
@@ -29,19 +35,9 @@
-
-
-
- PreserveNewest
- True
- \
-
-
- PreserveNewest
- True
- \
-
+
+
diff --git a/RELEASE-NOTE.md b/RELEASE-NOTE.md
index bdabf6c..c5a8529 100644
--- a/RELEASE-NOTE.md
+++ b/RELEASE-NOTE.md
@@ -1,5 +1,71 @@
-# Release Notes for CpuGuard.NET
-## Version 1.0.1
+# Release Notes for CpuGuard.NET
+
+## Version 2.0.0
+
+### Major Release - Comprehensive Resource Management
+
+This release transforms CpuGuard.NET into a full-featured resource management middleware with 10 new capabilities.
+
+#### New Features
+
+1. **Memory Limiting (MemoryGuard)**
+ - Monitor and limit memory usage with percentage or absolute byte thresholds
+ - Configurable response handling when limits are exceeded
+
+2. **Custom Response Handlers**
+ - Define custom responses for throttled requests
+ - Support for JSON, HTML, or any content type
+
+3. **Event Callbacks**
+ - Subscribe to `OnCpuLimitExceeded` and `OnMemoryLimitExceeded` events
+ - Integrate with logging, alerting, and monitoring systems
+
+4. **Health Check Integration**
+ - ASP.NET Core health check support with `AddCpuGuardHealthChecks()`
+ - Configurable degraded and unhealthy thresholds
+
+5. **OpenTelemetry Metrics**
+ - Built-in metrics: `cpuguard_requests_throttled_total`, `cpuguard_cpu_usage_percent`, etc.
+ - Export to Prometheus, Grafana, and other observability platforms
+
+6. **Gradual Throttling**
+ - Progressive request delays as resource usage increases
+ - Soft limit (start delaying) and hard limit (reject) thresholds
+ - Linear or exponential delay modes
+
+7. **Path Exclusions**
+ - Exclude specific paths from all guards (e.g., `/health`, `/metrics`)
+ - Support for custom exclusion predicates
+
+8. **Rate Limiting**
+ - Per-client rate limiting with Fixed Window, Sliding Window, or Token Bucket algorithms
+ - CPU-aware rate limiting that reduces limits under high load
+ - Standard `X-RateLimit-*` response headers
+
+9. **Real-time Dashboard**
+ - Built-in HTML dashboard with live charts at `/cpuguard/dashboard`
+ - JSON stats API at `/cpuguard/stats` and `/cpuguard/stats/full`
+ - CPU/memory gauges, request statistics, and system info
+
+10. **Background Resource Monitoring**
+ - Async CPU sampling via `ResourceMonitorService`
+ - Accurate resource tracking without blocking requests
+
+#### Breaking Changes
+
+- Middleware now requires service registration via `AddCpuGuard()`, `AddMemoryGuard()`, etc.
+- Legacy API (`UseCpuLimitMiddleware`) still supported but deprecated
+
+#### New Dependencies
+
+- `Microsoft.Extensions.Hosting.Abstractions` (6.0.0)
+- `Microsoft.Extensions.Diagnostics.HealthChecks` (6.0.0)
+- `OpenTelemetry.Api` (1.7.0)
+- `System.Text.Json` (8.0.5)
+
+---
+
+## Version 1.0.1
#### Whole Application CPU Limit:
1. Introduced a middleware component to limit CPU usage across the entire ASP.NET Core application.