Skip to content

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

Merged
martincostello merged 4 commits intoApp-vNext:mainfrom
peter-csala:add-sequence-diagrams-part-2
Oct 18, 2023
Merged

[Docs] Add sequence diagrams to fallback, retry, and rate limiter#1702
martincostello merged 4 commits intoApp-vNext:mainfrom
peter-csala:add-sequence-diagrams-part-2

Conversation

@peter-csala
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@martincostello
Copy link
Copy Markdown
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
@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