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

[Docs] Add sequence diagrams to fallback, retry, and rate limiter #1702

Merged

Conversation

peter-csala
Copy link
Contributor

@peter-csala peter-csala commented Oct 17, 2023

Pull Request

The issue or feature being addressed

  • Add sequence diagrams to the documentation to ease the understanding of the strategies

Details on the issue fix or feature implementation

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

### Happy path sequence diagram

```mermaid
%%{init: {'theme':'dark'}}%%
Copy link
Member

Choose a reason for hiding this comment

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

This looks quite bad if you don't use the dark theme: #1701 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the mermaid documentation site the diagrams are dynamically switching between default and dark theme depending on the selected appearance mode. I haven't figured out yet how they do that so, I will spend some time to dig deeper.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about we just don't do anything and raise an issue in DocFx repo?

My thinking is that default behavior should handle this automatically.

Copy link
Member

@martincostello martincostello Oct 17, 2023

Choose a reason for hiding this comment

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

I would agree that it should just work.

If we can't make it look good for both light and dark, then we should use whichever variant looks less worse.

How does the default/light diagram look in dark mode?

Copy link
Contributor

Choose a reason for hiding this comment

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

The defaults for white theme:

image

Dark theme:
image

Copy link
Contributor Author

@peter-csala peter-csala Oct 17, 2023

Choose a reason for hiding this comment

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

I've found how they do it. :)

const renderChart = async () => {
  const hasDarkClass = document.documentElement.classList.contains('dark');
  const mermaidConfig = {
     ...   
    theme: hasDarkClass ? 'dark' : 'default',
  };
  ...
}

I don't think we can do similar via the docfx config :(

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to add a custom module/script to apply a global config or something when the page is being rendered in the client? Docs

If not, would be good to create an issue in the docfx repo if there isn't one already requesting this feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@martintmk, @martincostello I've filed an issue on docfx: dotnet/docfx#9306.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shall we add a note to the diagrams sections something like:

Please prefer dark appearance mode for better legibility ... it is a temporarily solution

?

Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid a comment - otherwise if we have lots of diagrams I think it's just going to duplicate all over the place.

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (a3ca9d0) 84.65% compared to head (5039e4f) 84.65%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1702   +/-   ##
=======================================
  Coverage   84.65%   84.65%           
=======================================
  Files         306      306           
  Lines        6829     6829           
  Branches     1046     1046           
=======================================
  Hits         5781     5781           
  Misses        839      839           
  Partials      209      209           
Flag Coverage Δ
linux 84.65% <ø> (ø)
macos 84.65% <ø> (ø)
windows 84.65% <ø> (ø)

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.

@martintmk
Copy link
Contributor

@martincostello The code-ql scan is super jumpy and annoying lately. I had to retry last PR 4 times before getting successful build.

Can we temporary make it optional until Roslyn team figures what's happening?
dotnet/roslyn#70368

@martincostello
Copy link
Member

martincostello commented Oct 17, 2023

Can we temporary make it optional until Roslyn team figures what's happening?

I don't have the powers to change that, but yeah I noticed it's been worse than usual which is why I finally logged the issue 😅

@martintmk
Copy link
Contributor

Can we temporary make it optional until Roslyn team figures what's happening?

I don't have the powers to change that, but yeah I noticed it's been worse than usual which is why I finally logged the issue 😅

Maybe disable all analyzers when code-ql is running? We have a lot of those and it's possible some are causing the Roslyn crash.

docs/strategies/fallback.md Outdated Show resolved Hide resolved
docs/strategies/rate-limiter.md Outdated Show resolved Hide resolved
docs/strategies/retry.md Outdated Show resolved Hide resolved
docs/strategies/retry.md Outdated Show resolved Hide resolved
@martincostello
Copy link
Member

Maybe disable all analyzers when code-ql is running? We have a lot of those and it's possible some are causing the Roslyn crash.

Do you want to do a PR to turn them off? The trouble is, CodeQL might be implemented as analyzers for C#, then basically making the whole thing run pointlessly.

@martincostello martincostello enabled auto-merge (squash) October 18, 2023 08:59
@martincostello martincostello merged commit f7d434a into App-vNext:main Oct 18, 2023
18 checks passed
@peter-csala peter-csala deleted the add-sequence-diagrams-part-2 branch October 31, 2023 16:27
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.

3 participants