CoreSystem.Resilience
1.0.4
See the version list below for details.
dotnet add package CoreSystem.Resilience --version 1.0.4
NuGet\Install-Package CoreSystem.Resilience -Version 1.0.4
<PackageReference Include="CoreSystem.Resilience" Version="1.0.4" />
<PackageVersion Include="CoreSystem.Resilience" Version="1.0.4" />
<PackageReference Include="CoreSystem.Resilience" />
paket add CoreSystem.Resilience --version 1.0.4
#r "nuget: CoreSystem.Resilience, 1.0.4"
#:package CoreSystem.Resilience@1.0.4
#addin nuget:?package=CoreSystem.Resilience&version=1.0.4
#tool nuget:?package=CoreSystem.Resilience&version=1.0.4
⚡ CoreSystem.Resilience
Production-ready resilience framework for .NET 8
CoreSystem.Resilience provides a clean abstraction over resilience strategies for .NET applications. It enables applications to define named resilience pipelines while keeping business code independent from the underlying resilience implementation.
✨ Features
- ✅ Retry strategy
- ✅ Circuit Breaker strategy
- ✅ Timeout strategy
- ✅ Named resilience pipelines
- ✅ Dependency Injection integration
- ✅ Polly abstraction
- ✅ Built-in metrics
- ✅ OpenTelemetry compatible
- ✅ Extensible strategy builders
- ✅ Strongly typed configuration
📦 Installation
dotnet add package CoreSystem.Resilience
🚀 Quick Start
builder.Services.AddResilience(options =>
{
options.AddPipeline(PipelineType.Redis, pipeline =>
{
pipeline.AddRetry(retry =>
{
retry.MaxRetryAttempts = 3;
});
pipeline.AddTimeout(timeout =>
{
timeout.Timeout = TimeSpan.FromSeconds(2);
});
pipeline.AddCircuitBreaker(cb =>
{
cb.FailureRatio = 0.5;
});
});
});
Resolve a pipeline:
public sealed class RedisService(
IResiliencePipelineProvider provider)
{
private readonly IResiliencePipeline _pipeline =
provider.GetPipeline(PipelineType.Redis);
}
Execute an operation:
await _pipeline.ExecuteAsync(async ct =>
{
await redis.GetAsync(key, ct);
});
🛡 Supported Strategies
| Strategy | Description |
|---|---|
| Retry | Retries transient failures. |
| Circuit Breaker | Prevents repeated calls to unhealthy dependencies. |
| Timeout | Limits the execution time of an operation. |
📊 Built-in Metrics
CoreSystem.Resilience publishes metrics using System.Diagnostics.Metrics.
These metrics are compatible with OpenTelemetry and any OTLP-compatible backend.
| Metric | Description |
|---|---|
core.resilience.executions |
Total pipeline executions. |
core.resilience.execution.duration |
Pipeline execution duration. |
core.resilience.retry.attempts |
Total retry attempts. |
core.resilience.retry.successes |
Successful executions after one or more retries. |
core.resilience.retry.failures |
Operations that failed after all retries. |
core.resilience.circuitbreaker.opened |
Circuit breaker opened events. |
core.resilience.circuitbreaker.closed |
Circuit breaker closed events. |
core.resilience.circuitbreaker.half_opened |
Circuit breaker half-open transitions. |
core.resilience.timeout.total |
Timeout events. |
core.resilience.failures |
Total failed pipeline executions. |
Register the meter:
builder.Services
.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddMeter("Core.Resilience");
});
Compatible Platforms
| Platform | Supported |
|---|---|
| Prometheus | ✅ |
| Grafana | ✅ |
| Azure Monitor | ✅ |
| OTLP | ✅ |
| Datadog | ✅ |
🏗 Architecture
Application
│
▼
IResiliencePipelineProvider
│
▼
IResiliencePipeline
│
├── Retry
├── Timeout
├── Circuit Breaker
├── Metrics
│
▼
Protected Operation
📖 Documentation
The full documentation includes:
- Getting Started
- Configuration
- Retry
- Circuit Breaker
- Timeout
- Metrics
- Architecture
- Extensibility
Visit the GitHub repository for the complete documentation.
🤝 Contributing
Issues, discussions and pull requests are welcome.
📄 License
Released under the MIT License.
| Product | Versions 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. |
-
net8.0
- CoreSystem.Observability.Abstractions (>= 1.0.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.28)
- Microsoft.Extensions.Options (>= 8.0.2)
- OpenTelemetry (>= 1.15.3)
- OpenTelemetry.Api (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- Polly (>= 8.7.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CoreSystem.Resilience:
| Package | Downloads |
|---|---|
|
CoreSystem.Cache
Production-ready cache abstraction for .NET 8 with In-Memory caching, extensible external storage, tag-based invalidation, HTTP response caching, and OpenTelemetry metrics. |
|
|
CoreSystem.Cache.Rehydration
Cache recovery component for CoreSystem.Cache on .NET 8 that restores tracked memory fallback entries to the primary cache provider after recovery. |
|
|
CoreSystem.Cache.Redis
Redis external cache provider for CoreSystem.Cache on .NET 8, with tag-based invalidation, distributed locking, health checks, and optional resilience integration. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release with Retry, Timeout, Circuit Breaker, OpenTelemetry metrics, and named resilience pipelines.