Skip to content

feat(ops): add uptime and SLA calculator - #47

Open
yeab-tatek wants to merge 1 commit into
juandresrodca:mainfrom
yeab-tatek:issue-31-uptime-sla-calculator
Open

yeab-tatek wants to merge 1 commit into
juandresrodca:mainfrom
yeab-tatek:issue-31-uptime-sla-calculator

Conversation

@yeab-tatek

Copy link
Copy Markdown

What this changes

Adds the uptime and SLA calculator from #31. It converts an availability target into the downtime it allows per day, week, month, quarter and year, works backwards from an allowed downtime, checks actual downtime against the target, and shows the common tiers from 99% to 99.999%.

Closes #31

Adding a tool?

  • The tool lives in its own folder under src/AdminForge.Tools/<Category>/, and no file outside that folder and its test changed
  • Id is kebab-case and matches the folder name
  • Description is one sentence, sentence case, under 110 characters, no trailing period
  • At least three lowercase Keywords, including the abbreviations people actually type
  • Icon is an existing id from src/AdminForge.Web/wwwroot/icons/sprite.svg
  • Compute is ClientSide if the input could ever be a secret (it can't; pure arithmetic)
  • Every [ToolField] has a Label, and every text field has a MaxLength
  • Expected failures return ToolResult.Fail with a message written for an admin
  • There is a test covering both a normal input and a bad one

Checks

  • dotnet test passes
  • dotnet format leaves nothing to change
  • node --test "tests/js/*.test.mjs" passes (not applicable, no browser module)
  • I ran it and looked at the result in a browser

Anything a reviewer should know

  • Conventions. A year is 365.25 days; a month is a year ÷ 12 (30.4375 days) and a quarter a year ÷ 4, so the windows agree with each other. This matches the issue's example of 8h 45m 57s for 99.9% a year.
  • Rounding. Durations are rounded down (to a tenth of a second under a minute), so a downtime budget is never overstated.
  • Decimal maths. SlaMath uses decimal, so 99.9% → downtime → 99.9% round-trips exactly.
  • Text fields for numbers. A double property renders as <input type="number"> with no step, and the browser rejects 99.9 at the default step of 1. The percentage and downtimes are therefore text fields, parsed with the invariant culture; thousands separators are refused so "1,5" isn't read as 15. A Step option on [ToolField] would let these become number fields; happy to open an issue for that.
  • One unit applies to both downtime fields, to keep the form short.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add uptime and SLA percentage calculator

1 participant