Repository navigation
feat: Resilion resilience library for .NET with 6 strategies, DI, telemetry, and docs #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
be35f9a
feat: Resilion resilience library for modern .NET
FreakyAli 742f7a1
fix: better futture-plans and more details about current known tradeoffs
FreakyAli 9b6cfaf
fix: valid coderabbit comments
FreakyAli f6d3a12
fix: better formatting and detailing
FreakyAli eb2cb27
fix: .net 8 target
FreakyAli a32911d
doc: indepth docs
FreakyAli 2d37e35
fix: circuit breaker related coderabbit bugs
FreakyAli df6bf45
fix: circuit break, resilience and hedging
FreakyAli 7cfa8f7
fix: more quicks wins for edge cases found in the code review
FreakyAli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| # EditorConfig — https://editorconfig.org | ||
| root = true | ||
|
|
||
| [*] | ||
| indent_style = space | ||
| indent_size = 4 | ||
| end_of_line = lf | ||
| charset = utf-8 | ||
| trim_trailing_whitespace = true | ||
| insert_final_newline = true | ||
|
|
||
| [*.{csproj,props,targets,xml,config,nuspec}] | ||
| indent_size = 2 | ||
|
|
||
| [*.{json,yml,yaml}] | ||
| indent_size = 2 | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false | ||
|
|
||
| [*.cs] | ||
| # Namespace | ||
| csharp_style_namespace_declarations = file_scoped:suggestion | ||
|
|
||
| # var preferences | ||
| csharp_style_var_for_built_in_types = true:suggestion | ||
| csharp_style_var_when_type_is_apparent = true:suggestion | ||
| csharp_style_var_elsewhere = true:suggestion | ||
|
|
||
| # Expression-bodied members | ||
| csharp_style_expression_bodied_methods = when_on_single_line:suggestion | ||
| csharp_style_expression_bodied_constructors = false:suggestion | ||
| csharp_style_expression_bodied_operators = when_on_single_line:suggestion | ||
| csharp_style_expression_bodied_properties = when_on_single_line:suggestion | ||
| csharp_style_expression_bodied_indexers = when_on_single_line:suggestion | ||
| csharp_style_expression_bodied_accessors = when_on_single_line:suggestion | ||
| csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion | ||
| csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion | ||
|
|
||
| # Pattern matching | ||
| csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion | ||
| csharp_style_pattern_matching_over_as_with_null_check = true:suggestion | ||
|
|
||
| # Null checking | ||
| csharp_style_throw_expression = true:suggestion | ||
| csharp_style_conditional_delegate_call = true:suggestion | ||
|
|
||
| # Modifier preferences | ||
| dotnet_style_require_accessibility_modifiers = always:suggestion | ||
|
|
||
| # this. qualification | ||
| dotnet_style_qualification_for_field = false:suggestion | ||
| dotnet_style_qualification_for_property = false:suggestion | ||
| dotnet_style_qualification_for_method = false:suggestion | ||
| dotnet_style_qualification_for_event = false:suggestion | ||
|
|
||
| # Language keywords vs BCL types | ||
| dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion | ||
| dotnet_style_predefined_type_for_member_access = true:suggestion | ||
|
|
||
| # Parentheses | ||
| dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion | ||
| dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion | ||
| dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion | ||
| dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion | ||
|
|
||
| # Newline preferences | ||
| csharp_new_line_before_open_brace = all | ||
| csharp_new_line_before_else = true | ||
| csharp_new_line_before_catch = true | ||
| csharp_new_line_before_finally = true | ||
| csharp_new_line_before_members_in_object_initializers = true | ||
| csharp_new_line_before_members_in_anonymous_types = true | ||
|
|
||
| # Indentation | ||
| csharp_indent_case_contents = true | ||
| csharp_indent_switch_labels = true | ||
|
|
||
| # Spacing | ||
| csharp_space_after_cast = false | ||
| csharp_space_after_keywords_in_control_flow_statements = true | ||
| csharp_space_between_method_declaration_parameter_list_parentheses = false | ||
| csharp_space_between_method_call_parameter_list_parentheses = false | ||
|
|
||
| # Wrapping | ||
| csharp_preserve_single_line_statements = false | ||
| csharp_preserve_single_line_blocks = true | ||
|
|
||
| # Using directives | ||
| dotnet_sort_system_directives_first = true | ||
| dotnet_separate_import_directive_groups = false | ||
|
|
||
| # Naming conventions | ||
| dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion | ||
| dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields | ||
| dotnet_naming_rule.private_fields_should_be_camel_case.style = camel_case_underscore | ||
|
|
||
| dotnet_naming_symbols.private_fields.applicable_kinds = field | ||
| dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected | ||
| dotnet_naming_symbols.private_fields.required_modifiers = | ||
|
|
||
| dotnet_naming_style.camel_case_underscore.required_prefix = _ | ||
| dotnet_naming_style.camel_case_underscore.capitalization = camel_case |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| --- | ||
| name: Bug report | ||
| about: Report a bug in Resilion | ||
| title: '' | ||
| labels: bug | ||
| assignees: '' | ||
|
|
||
| --- | ||
|
|
||
| **Resilion version** | ||
| <!-- e.g. 0.1.0 --> | ||
|
|
||
| **.NET SDK version** | ||
| <!-- Run `dotnet --version` and paste the output --> | ||
|
|
||
| **Target framework** | ||
| <!-- e.g. net9.0 --> | ||
|
|
||
| **Describe the bug** | ||
| A clear description of what the bug is. | ||
|
|
||
| **Minimal reproduction** | ||
| <!-- Paste the smallest code that reproduces the issue --> | ||
|
|
||
| ```csharp | ||
| var pipeline = Pipeline.Create(builder => builder | ||
| .AddRetry(new RetryStrategyOptions { MaxRetryAttempts = 3 }) | ||
| .AddTimeout(TimeSpan.FromSeconds(10))); | ||
|
|
||
| await pipeline.ExecuteAsync(async (state, ct) => | ||
| { | ||
| // Your operation here | ||
| return null; | ||
| }, (object?)null, CancellationToken.None); | ||
| ``` | ||
|
|
||
| **Expected behavior** | ||
| What you expected to happen. | ||
|
|
||
| **Actual behavior** | ||
| What actually happened. Include any exceptions or stack traces. | ||
|
|
||
| **Additional context** | ||
| Any other context about the problem. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| name: Feature request | ||
| about: Suggest a feature for Resilion | ||
| title: '' | ||
| labels: enhancement | ||
| assignees: '' | ||
|
|
||
| --- | ||
|
|
||
| **Is your feature request related to a problem?** | ||
| A clear description of what the problem is. | ||
|
|
||
| **Describe the solution you'd like** | ||
| A clear description of what you want to happen. | ||
|
|
||
| **Describe alternatives you've considered** | ||
| Any alternative solutions or features you've considered. | ||
|
|
||
| **Additional context** | ||
| Any other context, code examples, or references about the feature request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
|
|
||
| env: | ||
| DOTNET_VERSION: '9.0.x' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
|
||
| - name: Restore | ||
| run: dotnet restore | ||
|
|
||
| - name: Build | ||
| run: dotnet build -c Release --no-restore | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: Create a release on NuGet | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
| - "v*.*.*-pre" | ||
|
|
||
| env: | ||
| DOTNET_VERSION: '9.0.x' | ||
|
|
||
| jobs: | ||
| release-nuget: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
|
||
| - name: Verify commit exists in origin/master | ||
| run: | | ||
| git fetch --no-tags --prune origin +refs/heads/*:refs/remotes/origin/* | ||
| git merge-base --is-ancestor origin/master HEAD || { echo "Tag is not on origin/master. Aborting release."; exit 1; } | ||
|
|
||
| - name: Get version information from tag | ||
| id: get_version | ||
| run: | | ||
| VERSION="${GITHUB_REF_NAME#v}" | ||
| # Validate SemVer format (basic check for X.Y.Z or X.Y.Z-prerelease) | ||
| if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then | ||
| echo "Invalid version format: $VERSION" | ||
| exit 1 | ||
| fi | ||
| echo "version_without_v=$VERSION" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Build | ||
| env: | ||
| VERSION: ${{ steps.get_version.outputs.version_without_v }} | ||
| run: dotnet build -c Release -p:Version="${VERSION}" | ||
|
|
||
| - name: Test | ||
| run: dotnet test -c Release --no-build | ||
|
|
||
| - name: Pack NuGet packages | ||
| env: | ||
| VERSION: ${{ steps.get_version.outputs.version_without_v }} | ||
| run: | | ||
| dotnet pack src/Resilion/Resilion.csproj -c Release --no-build -p:Version="${VERSION}" | ||
| dotnet pack src/Resilion.Extensions/Resilion.Extensions.csproj -c Release --no-build -p:Version="${VERSION}" | ||
| dotnet pack src/Resilion.RateLimiting/Resilion.RateLimiting.csproj -c Release --no-build -p:Version="${VERSION}" | ||
|
|
||
| - name: NuGet login (OIDC - trusted publishing) | ||
| id: login | ||
| uses: NuGet/login@v1 | ||
| with: | ||
| user: FreakyAli | ||
|
|
||
| - name: Push NuGet packages | ||
| run: | | ||
| VERSION="${{ steps.get_version.outputs.version_without_v }}" | ||
| NUPKGS=$(find . -name "*.nupkg" -path "*${VERSION}*" ! -name "*.symbols.nupkg") | ||
| COUNT=$(echo "$NUPKGS" | wc -l) | ||
| if [ "$COUNT" -ne 3 ]; then | ||
| echo "Expected exactly 3 matching .nupkg files, found $COUNT. Aborting." | ||
| exit 1 | ||
| fi | ||
| echo "$NUPKGS" | while read -r nupkg; do | ||
| echo "Pushing: $nupkg" | ||
| dotnet nuget push "$nupkg" -s https://api.nuget.org/v3/index.json -k ${{ steps.login.outputs.NUGET_API_KEY }} | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: test | ||
| run-name: '[Test] ${{ github.event.head_commit.message || github.event.pull_request.title || github.ref_name }}' | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - "*" | ||
| push: | ||
| branches: | ||
| - "master" | ||
|
|
||
| permissions: | ||
| contents: read | ||
| checks: write | ||
| pull-requests: write | ||
|
|
||
| env: | ||
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
| DOTNET_NOLOGO: true | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
FreakyAli marked this conversation as resolved.
|
||
| persist-credentials: false | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: 9.0.x | ||
|
|
||
| - name: Restore dependencies | ||
| run: dotnet restore | ||
|
|
||
| - name: Build Solution | ||
| run: dotnet build --configuration Release --no-restore | ||
|
|
||
| - name: Run Unit Tests | ||
| run: dotnet test --configuration Release --no-build -- --report-trx --results-directory ${{ github.workspace }}/TestResults | ||
|
|
||
| - name: Upload Test Results | ||
| uses: actions/upload-artifact@v4 | ||
| if: success() || failure() | ||
| with: | ||
| name: test-results-${{ github.run_id }} | ||
| path: TestResults/*.trx | ||
| retention-days: 7 | ||
|
|
||
| - name: Publish Test Results | ||
| uses: dorny/test-reporter@v1 | ||
| if: success() || failure() | ||
| with: | ||
| name: Unit Test Results | ||
| path: TestResults/*.trx | ||
| reporter: dotnet-trx | ||
| fail-on-error: false | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.