Skip to content
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

update circuitbreaker document #1808

Merged
merged 7 commits into from
Dec 14, 2023
Merged

Conversation

atawLee
Copy link
Contributor

@atawLee atawLee commented Nov 17, 2023

#1776

Update documentation for the CircuitBreaker's BreakDurationGenerator

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (033b02f) 84.58% compared to head (5c6814f) 84.58%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1808   +/-   ##
=======================================
  Coverage   84.58%   84.58%           
=======================================
  Files         308      308           
  Lines        6799     6799           
  Branches     1049     1049           
=======================================
  Hits         5751     5751           
  Misses        839      839           
  Partials      209      209           
Flag Coverage Δ
linux 84.58% <ø> (ø)
macos 84.58% <ø> (ø)
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martincostello martincostello added this to the v8.2.0 milestone Nov 17, 2023
Copy link
Member

@martincostello martincostello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going through #1776 (comment) looks like just a diagram is needed to complete the suggestions.

docs/strategies/circuit-breaker.md Outdated Show resolved Hide resolved
atawLee and others added 3 commits November 17, 2023 23:11
## Defaults Align
Update the alignment of the table a bit more.
@peter-csala
Copy link
Contributor

@atawLee Do you need some help with the diagram? I can create one if you wish.

@atawLee
Copy link
Contributor Author

atawLee commented Dec 8, 2023

@atawLee Do you need some help with the diagram? I can create one if you wish.

Yes, I would really appreciate your help with the diagram.

@peter-csala
Copy link
Contributor

@atawLee Do you need some help with the diagram? I can create one if you wish.

Yes, I would really appreciate your help with the diagram.

Here it is:

sequenceDiagram
    autonumber
    actor C as Caller
    participant P as Pipeline
    participant CB as CircuitBreaker
    participant BDG as BreakDurationGenerator
    participant D as DecoratedUserCallback

    C->>P: Calls ExecuteAsync
    P->>CB: Calls ExecuteCore
    Note over CB: Closed state
    CB->>+D: Invokes
    D->>-CB: Fails
    Note over CB: Moves to Open state
    CB->>+BDG: Calls Generator
    BDG->>-CB: Returns calculated <br/> duration 
    Note over CB: Break duration start
    CB->>P: Propagates failure
    P->>C: Propagates failure

    C->>P: Calls ExecuteAsync
    P->>CB: Calls ExecuteCore
    CB-->>CB: Rejects request
    CB->>P: Throws <br/>BrokenCircuitException
    P->>C: Propagates exception

    C->>P: Calls ExecuteAsync
    P->>CB: Calls ExecuteCore
    Note over CB: Break duration end
    Note over CB: Moves to HalfOpen state
    CB->>+D: Invokes
    D->>-CB: Returns result
    Note over CB: Moves to Closed state
    CB->>P: Returns result
    P->>C: Returns result
Loading

And the code:

sequenceDiagram
    autonumber
    actor C as Caller
    participant P as Pipeline
    participant CB as CircuitBreaker
    participant BDG as BreakDurationGenerator
    participant D as DecoratedUserCallback

    C->>P: Calls ExecuteAsync
    P->>CB: Calls ExecuteCore
    Note over CB: Closed state
    CB->>+D: Invokes
    D->>-CB: Fails
    Note over CB: Moves to Open state
    CB->>+BDG: Calls Generator
    BDG->>-CB: Returns calculated <br/> duration 
    Note over CB: Break duration start
    CB->>P: Propagates failure
    P->>C: Propagates failure

    C->>P: Calls ExecuteAsync
    P->>CB: Calls ExecuteCore
    CB-->>CB: Rejects request
    CB->>P: Throws <br/>BrokenCircuitException
    P->>C: Propagates exception

    C->>P: Calls ExecuteAsync
    P->>CB: Calls ExecuteCore
    Note over CB: Break duration end
    Note over CB: Moves to HalfOpen state
    CB->>+D: Invokes
    D->>-CB: Returns result
    Note over CB: Moves to Closed state
    CB->>P: Returns result
    P->>C: Returns result

Enjoy 💪

@martincostello
Copy link
Member

BreakDurationGenerator needs adding to the spellcheck dictionary.

Co-authored-by: Martin Costello <martin@martincostello.com>
@martincostello martincostello merged commit 51a0ff2 into App-vNext:main Dec 14, 2023
17 checks passed
@martincostello martincostello modified the milestones: v8.2.0, v8.3.0 Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants