Skip to content

Commit

Permalink
Adds gh-pages support (#1593)
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk authored Sep 18, 2023
1 parent 2c5fc26 commit 5f21530
Show file tree
Hide file tree
Showing 23 changed files with 262 additions and 71 deletions.
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"commands": [
"mdsnippets"
]
},
"docfx": {
"version": "2.70.3",
"commands": [
"docfx"
]
}
}
}
37 changes: 37 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is a basic workflow to help you get started with Actions

name: github-pages

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x

- run: dotnet tool restore

- run: dotnet docfx docs/docfx.json

- name: Deploy
# if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
> :rotating_light::rotating_light: **Polly v8 feature-complete!** :rotating_light::rotating_light:
> - Polly v8 Beta 2 is now available on [NuGet.org](https://www.nuget.org/packages/Polly/8.0.0-beta.2).
> - The Beta 2 version is considered feature-complete and the public API surface is stable.
> - Explore the [v8 documentation](https://github.com/App-vNext/Polly/blob/main/README_V8.md).
> - Explore the [v8 documentation](https://www.pollydocs.org/).
# Polly

Expand Down Expand Up @@ -1063,4 +1063,4 @@ Licensed under the terms of the [New BSD License](http://opensource.org/licenses

## Resources

Visit the [documentation](docs/README.md) to explore more Polly-related resources.
Visit the [documentation](<https://www.pollydocs.org/>) to explore more Polly-related resources.
2 changes: 1 addition & 1 deletion README_V8.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ Rate limiter strategy throws `RateLimiterRejectedException` if execution is reje

## Next steps

To learn more about Polly, visit the [documentation](docs/README.md) or check out the [samples](#samples).
To learn more about Polly, visit the <https://www.pollydocs.org/>.

## Samples

Expand Down
9 changes: 9 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
###############
# folder #
###############
/**/DROP/
/**/TEMP/
/**/packages/
/**/bin/
/**/obj/
_site
57 changes: 0 additions & 57 deletions docs/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/advanced/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Execution attempt. Source: '{PipelineName}/{PipelineInstance}/{StrategyName}', O

## Emitting telemetry events

Each resilience strategy can generate telemetry data through the [`ResilienceStrategyTelemetry`](../src/Polly.Core/Telemetry/ResilienceStrategyTelemetry.cs) API. Polly encapsulates event details as [`TelemetryEventArguments`](../src/Polly.Core/Telemetry/TelemetryEventArguments.cs) and emits them via `TelemetryListener`.
Each resilience strategy can generate telemetry data through the [`ResilienceStrategyTelemetry`](xref:Polly.Telemetry.ResilienceStrategyTelemetry) API. Polly encapsulates event details as [`TelemetryEventArguments`](xref:Polly.Telemetry.TelemetryEventArguments`2) and emits them via `TelemetryListener`.

To leverage this telemetry data, users should assign a `TelemetryListener` instance to `ResiliencePipelineBuilder.TelemetryListener` and then consume the `TelemetryEventArguments`.

Expand Down
5 changes: 5 additions & 0 deletions docs/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
###############
# temp file #
###############
*.yml
.manifest
2 changes: 2 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# PLACEHOLDER
TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*!
69 changes: 69 additions & 0 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"metadata": [
{
"src": [
{
"cwd": "../src",
"files": [
"**/**.csproj"
],
"exclude": [
"**/obj/**",
"**/bin/**",
"_site/**",
"Polly/**",
"v7/**"
]
}
],
"dest": "api",
"includePrivateMembers": false,
"disableGitFeatures": false,
"disableDefaultFilter": false,
"noRestore": false,
"namespaceLayout": "flattened",
"memberLayout": "samePage",
"EnumSortOrder": "alphabetic",
"allowCompilationErrors": false
}
],
"build": {
"globalMetadata": {
"_appLogoPath": "icon.png",
"_appFaviconPath": "icon.png"
},
"content": [
{
"files": [
"api/**.yml",
"api/README.md"
]
},
{
"files": [
"**.md",
"**.yml",
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"icon.png"
]
}
],
"output": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default",
"modern"
],
"postProcessors": [],
"keepFileLink": false,
"disableGitFeatures": false
}
}
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Getting started

To use Polly, you must provide a callback and execute it using [**resilience pipeline**](pipelines/readme.md). A resilience pipeline is a combination of one or more [**resilience strategies**](strategies/readme.md) such as retry, timeout, and rate limiter. Polly uses **builders** to integrate these strategies into a pipeline.
To use Polly, you must provide a callback and execute it using [**resilience pipeline**](pipelines/index.md). A resilience pipeline is a combination of one or more [**resilience strategies**](strategies/index.md) such as retry, timeout, and rate limiter. Polly uses **builders** to integrate these strategies into a pipeline.

To get started, first add the [Polly.Core](https://www.nuget.org/packages/Polly.Core/) package to your project by running the following command:

Expand Down
Binary file added docs/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Meet Polly: The .NET resilience library

> [!NOTE]
> This is documentation for the upcoming Polly v8 release.
![Polly logo](https://raw.github.com/App-vNext/Polly/main/Polly-Logo.png)

Polly is a powerful library for .NET that helps you handle transient faults and improve the resilience of your applications. With Polly, you can easily define and apply strategies such as Retry, Circuit Breaker, Hedging, Timeout, Rate Limiter and Fallback to handle failures and slowdowns in a fluent and thread-safe way.

Polly is part of the [.NET Foundation](https://www.dotnetfoundation.org/about)!

## What can Polly do for you?

Polly lets you use and combine different resilience strategies to cope with various scenarios, such as:

- [Retry](strategies/retry.md): Try again if something fails. This can be useful when the problem is temporary and might go away.
- [Circuit Breaker](strategies/circuit-breaker.md): Stop trying if something is broken or busy. This can benefit you by avoiding wasting time and making things worse. It can also support the system to recover.
- [Timeout](strategies/timeout.md): Give up if something takes too long. This can improve your performance by freeing up space and resources.
- [Rate Limiter](strategies/rate-limiter.md): Limit how many requests you make or accept. This can enable you to control the load and prevent problems or penalties.
- [Fallback](strategies/fallback.md): Do something else if something fails. This can improve your user experience and keep the program working.
- [Hedging](strategies/hedging.md): Do more than one thing at the same time and take the fastest one. This can make your program faster and more responsive.

You can learn more about each strategy and how to use them [resilience strategies](strategies/index.md) section.

## How to get started with Polly?

Polly is easy to install and use. You can follow the [getting started](getting-started.md) guide to add Polly to your project and use it for your requests.

## Where to find more information?

Polly has a rich documentation that covers various topics, such as:

- [Resilience strategies](strategies/index.md): A collection of strategies for improving the resilience of your system.
- [Resilience pipelines](pipelines/index.md): How to combine and reuse strategies in a flexible and modular way.
- [Telemetry and monitoring](advanced/telemetry.md): How to access and analyze the data generated by Polly strategies and pipelines.
- [Dependency injection](advanced/dependency-injection.md): How to integrate Polly with dependency injection frameworks and containers.
- [Extensibility](advanced/extensibility.md): How to create and use custom strategies and extensions for Polly.
- [Chaos engineering](advanced/simmy.md): How to use Polly to inject faults and test the resilience of your system.

You can also find many resources and community contributions, such as:

- [Samples](https://github.com/App-vNext/Polly/tree/main/samples): Samples in this repository that serve as an introduction to Polly.
- [Practical Samples](https://github.com/App-vNext/Polly-Samples): Practical examples for using various implementations of Polly. Please feel free to contribute to the Polly-Samples repository in order to assist others who are either learning Polly for the first time, or are seeking advanced examples and novel approaches provided by our generous community.
- [Polly-Contrib](community/polly-contrib.md)): Community projects and libraries that extend and enhance Polly's functionality and ecosystem.
- [Libraries and contributions](community/libraries-and-contributions.html): Dependencies and contributors that make Polly possible and awesome.
- Microsoft's [eShopOnContainers project](https://github.com/dotnet-architecture/eShopOnContainers): Sample project demonstrating a .NET Microservices architecture and using Polly for resilience.

You can browse the documentation using the sidebar or visit the [API](api/index.md) section for the reference documentation.
1 change: 1 addition & 0 deletions docs/migration-v8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Migration guide from v7 to v8
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/strategies/circuit-breaker.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## About

- **Options**:
- [`CircuitBreakerStrategyOptions`](../../src/Polly.Core/CircuitBreaker/CircuitBreakerStrategyOptions.cs)
- [`CircuitBreakerStrategyOptions<T>`](../../src/Polly.Core/CircuitBreaker/CircuitBreakerStrategyOptions.TResult.cs)
- [`CircuitBreakerStrategyOptions`](xref:Polly.CircuitBreaker.CircuitBreakerStrategyOptions)
- [`CircuitBreakerStrategyOptions<T>`](xref:Polly.CircuitBreaker.CircuitBreakerStrategyOptions)
- **Extensions**: `AddCircuitBreaker`
- **Strategy Type**: Reactive
- **Exceptions**:
Expand Down
2 changes: 1 addition & 1 deletion docs/strategies/fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## About

- **Options**: [`FallbackStrategyOptions<T>`](../../src/Polly.Core/Fallback/FallbackStrategyOptions.TResult.cs)
- **Options**: [`FallbackStrategyOptions<T>`](xref:Polly.Fallback.FallbackStrategyOptions`1)
- **Extensions**: `AddFallback`
- **Strategy Type**: Reactive

Expand Down
2 changes: 1 addition & 1 deletion docs/strategies/hedging.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## About

- **Options**: [`HedgingStrategyOptions<T>`](../../src/Polly.Core/Hedging/HedgingStrategyOptions.TResult.cs)
- **Options**: [`HedgingStrategyOptions<T>`](xref:Polly.Hedging.HedgingStrategyOptions`1)
- **Extensions**: `AddHedging`
- **Strategy Type**: Reactive

Expand Down
13 changes: 12 additions & 1 deletion docs/strategies/README.md → docs/strategies/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,20 @@ Polly categorizes resilience strategies into two main groups:
- **Reactive**: These strategies handle specific exceptions that are thrown, or results that are returned, by the callbacks executed through the strategy.
- **Proactive**: Unlike reactive strategies, proactive strategies do not focus on handling errors by the callbacks might throw or return. They can make proactive decisions to cancel or reject the execution of callbacks (e.g., using a rate limiter or a timeout resilience strategy).

## Built-in strategies

| Strategy | Reactive | Premise | AKA | How does the strategy mitigate?|
| ------------- | --- | ------------- |:-------------: |------------- |
|[Retry](retry.md) |Yes|Many faults are transient and may self-correct after a short delay.| *Maybe it's just a blip* | Allows configuring automatic retries. |
|[Circuit-breaker](circuit-breaker.md) |Yes|When a system is seriously struggling, failing fast is better than making users/callers wait. <br/><br/>Protecting a faulting system from overload can help it recover. | *Stop doing it if it hurts* <br/><br/>*Give that system a break* | Breaks the circuit (blocks executions) for a period, when faults exceed some pre-configured threshold. |
|[Timeout](timeout.md)|No|Beyond a certain wait, a success result is unlikely.| *Don't wait forever* |Guarantees the caller won't have to wait beyond the timeout. |
|[Rate Limiter](rate-limiter.md)|No|Limiting the rate a system handles requests is another way to control load. <br/><br/> This can apply to the way your system accepts incoming calls, and/or to the way you call downstream services. | *Slow down a bit, will you?* |Constrains executions to not exceed a certain rate. |
|[Fallback](fallback.md)|Yes|Things will still fail - plan what you will do when that happens.| *Degrade gracefully* |Defines an alternative value to be returned (or action to be executed) on failure. |
|[Hedging](hedging.md)|Yes|Things can be slow sometimes, plan what you will do when that happens.| *Hedge your bets* | Executes parallel actions when things are slow and waits for the fastest one. |

## Usage

Extensions for adding resilience strategies to the builders are provided by each strategy. Depending on the type of strategy, these extensions may be available for both `ResiliencePipelineBuilder` and `ResiliencePipelineBuilder<T>` or just one of them. Proactive strategies like timeout or rate limiter are available for both types of builders, while specialized reactive strategies are only available for `ResiliencePipelineBuilder<T>`. Adding multiple resilience strategies is supported.
Extensions for adding resilience strategies to e builders are provided by each strategy. Depending on the type of strategy, these extensions may be available for both `ResiliencePipelineBuilder` and `ResiliencePipelineBuilder<T>` or just one of them. Proactive strategies like timeout or rate limiter are available for both types of builders, while specialized reactive strategies are only available for `ResiliencePipelineBuilder<T>`. Adding multiple resilience strategies is supported.

Each resilience strategy provides:

Expand Down
2 changes: 1 addition & 1 deletion docs/strategies/rate-limiter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## About

- **Options**: [`RateLimiterStrategyOptions`](../../src/Polly.RateLimiting/RateLimiterStrategyOptions.cs)
- **Options**: [`RateLimiterStrategyOptions`](xref:Polly.RateLimiting.RateLimiterStrategyOptions)
- **Extensions**: `AddRateLimiter`, `AddConcurrencyLimiter`
- **Strategy Type**: Proactive
- **Exceptions**:
Expand Down
4 changes: 2 additions & 2 deletions docs/strategies/retry.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## About

- **Options**:
- [`RetryStrategyOptions`](../../src/Polly.Core/Retry/RetryStrategyOptions.cs)
- [`RetryStrategyOptions<T>`](../../src/Polly.Core/Retry/RetryStrategyOptions.TResult.cs)
- [`RetryStrategyOptions`](xref:Polly.Retry.RetryStrategyOptions)
- [`RetryStrategyOptions<T>`](xref:Polly.Retry.RetryStrategyOptions`1)
- **Extensions**: `AddRetry`
- **Strategy Type**: Reactive

Expand Down
Loading

0 comments on commit 5f21530

Please sign in to comment.