Documentation
¶
Overview ¶
What the estimate assumes, as the reports say it.
Ports manager packages/estimate/src/estimate.ts (assumptionsOf).
Companion databases (the user, 2026-10-11): a database whose security group lets in an elected workload's naps with it, unless another workload of the region reaches it too (excluded ones included: it would cut them off), its tags are excluded, it cannot be stopped, or its workload wakes more than --max-wakes-rds a day (it takes minutes to start). Each elected workload priced: its actual cost, each companion replayed with the workload's requests while it was available and added, then those saving less than --min-saving a month apart.
Ports manager packages/estimate/src/estimate.ts (estimateAll: the companion databases and the elected workloads' loop).
Each eligible workload of a region elected or left out: its requests replayed by the product's idle window advisor at the report's window and at its recommended one, priced by the price book; what cannot be estimated, with the reason; those waking more than --max-wakes a day apart.
Ports manager packages/estimate/src/estimate.ts (estimateAll: its loop over the regions and their workloads).
Numbers and dates in text as Node writes them: a number in a template literal (Number.prototype.toString), toFixed(1), Date's toISOString and Date.parse.
An object whose keys keep the order they came in: Node's byAccount, byRegion and accountNames are objects, written (and shown in the reports) in their insertion order, which a Go map loses.
The workloads left out by their tags (vision docs/specs/2026-10-10-savings-estimate-design.md §3, --exclude-tags), after discovery and before the requests are read: any criterion excludes; in one, every key (and), each with one of its values (none: any value), matched as discovery's resourceTags against the tags of the workload's load balancer, target group or rule.
Ports manager packages/estimate/src/tags.ts (TagCriterion, Excluded, describeTags, excludeByTags).
The totals, with Dormeto's cost: a router per account and region with workloads, each workload, the manager once; each account's and region's workloads not estimated, whatever the reason; the estimate as the reports read it. Dormeto already installed (Go only, the user, 2026-10-13): its cost now and what the recommendation changes in it.
Ports manager packages/estimate/src/estimate.ts (estimateAll: its totals and its result).
Package estimate is phase 3 of the estimate (vision docs/specs/2026-10-10-savings-estimate-design.md §6): each eligible workload's requests replayed by the product's idle window advisor (R10) and priced by its price book, at the report's window (--window, an hour by default) and at the recommended one; what cannot be estimated, with the reason; the totals by account, region and all, net of Dormeto's cost. Conservative where the facts are unknown before install (decision 5).
This file ports the types of manager packages/estimate/src/estimate.ts (WorkloadEstimate, Companion, LeftOutCode, DatabaseLeftOut, LeftOut, Busy, Small, Kinds, Totals, CostPart, DormetoCost, Estimate). Each marshals to the JSON Node writes: the same names, in the same order, fields Node leaves undefined absent.
Index ¶
- func DescribeTags(c TagCriterion) string
- func JSNumber(v float64) string
- type AtWindow
- type Busy
- type Change
- type Companion
- type CostPart
- type DatabaseLeftOut
- type DatabaseRef
- type DatabasesUnread
- type DormetoCost
- type Estimate
- type Excluded
- type FailedRegion
- type IneligibleAt
- type Input
- type Kinds
- type LeftOut
- type LeftOutCode
- type Ordered
- type Period
- type Recommended
- type Routers
- type Small
- type TagCriterion
- type Totals
- type UnreadableCluster
- type Uptime
- type Where
- type WorkloadEstimate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DescribeTags ¶
func DescribeTags(c TagCriterion) string
DescribeTags says a criterion as discovery describes its resourceTags, its keys in order: "env=dev|test, team=web, dormeto:ignore".
Types ¶
type AtWindow ¶
type AtWindow struct {
USDMonth float64 `json:"usdMonth"`
WakesPerDay float64 `json:"wakesPerDay"`
AsleepHours float64 `json:"asleepHours"`
}
AtWindow is a workload's figures at the report's window: --window (options.Window), else its recommended window.
type Busy ¶
type Busy struct {
Workload discover.Workload `json:"workload"`
WakesPerDay float64 `json:"wakesPerDay"`
USDMonth float64 `json:"usdMonth"`
Minutes int `json:"minutes"`
}
Busy is a workload left out at its recommended window (Minutes) for waking more than --max-wakes a day, with what it would add.
type Change ¶
type Change struct {
Onboard int `json:"onboard"`
Excluded int `json:"excluded"`
Busy int `json:"busy"`
Small int `json:"small"`
RoutersAdded int `json:"routersAdded"`
RoutersRemoved int `json:"routersRemoved"`
ManagerRemoved bool `json:"managerRemoved"`
USDMonth float64 `json:"usdMonth"`
}
Change is what the recommendation changes in an installation (the user, 2026-10-13): the workloads estimated and not onboarded join it (Onboard); the onboarded ones the filters leave go (excluded by tags, waking more than --max-wakes, saving less than --min-saving), the others stay, estimated or not (asleep, nothing running to stop); the routers of the accounts and regions joining it or left without workloads; the manager when no workload stays. USDMonth: what it adds a month, negative when it removes.
type Companion ¶
type Companion struct {
Kind string `json:"kind"`
ID string `json:"id"`
USDMonth float64 `json:"usdMonth"`
RecommendedUSDMonth float64 `json:"recommendedUsdMonth"`
Uptime *Uptime `json:"uptime,omitempty"`
}
Companion is a companion database napped with its workload. Uptime: measured (--rds-uptime), the hours it was available a day, or why unknown (then all the time).
type CostPart ¶
type CostPart struct {
Count int `json:"count"`
UnitMonth float64 `json:"unitMonth"`
USDMonth float64 `json:"usdMonth"`
}
CostPart is a part of Dormeto's cost: how many, the cost of one a month, theirs.
type DatabaseLeftOut ¶
type DatabaseLeftOut struct {
Workload discover.Workload `json:"workload"`
Database DatabaseRef `json:"database"`
Reason string `json:"reason"`
Code LeftOutCode `json:"code"`
}
DatabaseLeftOut is a companion database left out, with its workload and why.
type DatabaseRef ¶
DatabaseRef names a database: its kind and identifier.
type DatabasesUnread ¶
type DatabasesUnread struct {
Account string `json:"account"`
Region string `json:"region"`
Reason string `json:"reason"`
}
DatabasesUnread is a region whose databases could not be read.
type DormetoCost ¶
type DormetoCost struct {
Manager CostPart `json:"manager"`
Routers Routers `json:"routers"`
Workloads CostPart `json:"workloads"`
Change *Change `json:"change,omitempty"`
USDMonth float64 `json:"usdMonth"`
}
DormetoCost is Dormeto's cost by part. Dormeto already installed (workloads onboarded in the accounts and regions estimated): the parts are the installation now and Change what the recommendation changes in it; else the parts are the recommendation's and Change is nil. USDMonth: the parts and the change, the totals' DormetoMonth.
type Estimate ¶
type Estimate struct {
GeneratedAt string `json:"generatedAt"`
Organization *string `json:"organization"`
Why *string `json:"why"`
// The options, without out and profiles (their JSON leaves them out).
Options options.Options `json:"options"`
Period Period `json:"period"`
Accounts int `json:"accounts"`
// The accounts reached before --accounts restricted them.
AccountsListed int `json:"accountsListed"`
AccountNames Ordered[string] `json:"accountNames"`
Totals Totals `json:"totals"`
Dormeto DormetoCost `json:"dormeto"`
ByAccount Ordered[Totals] `json:"byAccount"`
ByRegion Ordered[Totals] `json:"byRegion"`
Workloads []WorkloadEstimate `json:"workloads"`
LeftOut []LeftOut `json:"leftOut"`
// Excluded by their tags (--exclude-tags), before their requests were read.
Excluded []Excluded `json:"excluded"`
// Left out at their recommended window: waking more than options.MaxWakes a day, saving less than
// options.MinSaving.
Busy []Busy `json:"busy"`
Small []Small `json:"small"`
// Companion databases left out, with why; the regions whose databases could not be read.
DatabasesLeftOut []DatabaseLeftOut `json:"databasesLeftOut"`
DatabasesUnread []DatabasesUnread `json:"databasesUnread"`
Ineligible []IneligibleAt `json:"ineligible"`
Unreachable []accounts.Unreachable `json:"unreachable"`
FailedRegions []FailedRegion `json:"failedRegions"`
// The EKS clusters the profile cannot read (R10.5): their workloads are not estimated.
UnreadableClusters []UnreadableCluster `json:"unreadableClusters"`
Assumptions []string `json:"assumptions"`
}
Estimate is the estimate the reports are written from. Slices are never nil (written as []).
type Excluded ¶
type Excluded struct {
Workload discover.Workload `json:"workload"`
Criterion string `json:"criterion"`
}
Excluded is a workload left out by its tags, with the first criterion that matched, in the product's words.
func ExcludeByTags ¶
func ExcludeByTags(regions []discover.RegionDiscovery, criteria []TagCriterion) ([]discover.RegionDiscovery, []Excluded)
ExcludeByTags keeps the workloads no criterion matches, in copies of the regions; the others are excluded, each with the first criterion that matched. No criterion: the regions as given.
type FailedRegion ¶
type FailedRegion struct {
Account string `json:"account"`
Region string `json:"region"`
Error string `json:"error"`
}
FailedRegion is a region whose discovery failed.
type IneligibleAt ¶
type IneligibleAt struct {
Account string `json:"account"`
Region string `json:"region"`
discover.IneligibleRule
}
IneligibleAt is a rule that is not a workload, with its account and region.
type Input ¶
type Input struct {
Reached accounts.Reached
Regions []discover.RegionDiscovery
Requests []metrics.RegionRequests
// The price book's hourly price of an item in a region (its discounts closed over); nil: no list price. An error
// is no price either, as Node's catch.
Hourly func(ctx context.Context, region string, item stopped.Item) (*float64, error)
// A price lookup AWS refused (the Price List API, Spot price history): unpriced workloads say so. Nil or "": none.
PriceFailure func() string
Baseline prices.Baseline
// The options (Out and Profiles are left out of the estimate's JSON).
Options options.Options
Now time.Time
// The workloads excluded by their tags (ExcludeByTags).
Excluded []Excluded
// With --ec2-uptime, --ecs-uptime or --rds-uptime: when the workloads and databases ran. Nil: not measured (Node's
// null); a slice, even empty: measured.
Uptime []metrics.RegionUptime
}
Input is what All estimates (estimateAll's argument).
type Kinds ¶
type Kinds struct {
ASG int `json:"asg"`
EC2 int `json:"ec2"`
ECS int `json:"ecs"`
EKS int `json:"eks"`
}
Kinds are the workloads by backend: an Auto Scaling group, an EC2 instance, an ECS service, a Kubernetes owner on EKS.
type LeftOutCode ¶
type LeftOutCode string
LeftOutCode is why a companion database is left out, in a word (the summary counts them).
const ( CodeTags LeftOutCode = "tags" CodeStoppable LeftOutCode = "stoppable" CodeWakes LeftOutCode = "wakes" CodeStopped LeftOutCode = "stopped" CodeIdle LeftOutCode = "idle" CodePrice LeftOutCode = "price" )
The codes of a companion database left out.
type Ordered ¶
type Ordered[V any] struct { // contains filtered or unexported fields }
Ordered is a JSON object whose keys keep the order they were first set in, as a JavaScript object's (none of its keys is an array index, which JavaScript would put first: account ids have 12 digits, above 2^32, and regions are names). The zero value is empty.
func (Ordered[V]) MarshalJSON ¶
MarshalJSON writes the object, its keys in order.
func (*Ordered[V]) UnmarshalJSON ¶
UnmarshalJSON reads an object, keeping its keys' order.
type Period ¶ added in v0.2.0
Period is the period of the requests read (Go only, the user, 2026-10-14): its days (--days) and its dates, the reads' earliest start and latest end (a region kept from earlier the same day starts earlier); no read, the days before the run.
type Recommended ¶
type Recommended struct {
Minutes int `json:"minutes"`
USDMonth float64 `json:"usdMonth"`
WakesPerDay float64 `json:"wakesPerDay"`
}
Recommended is a workload's figures at its recommended window.
type Small ¶
type Small struct {
Workload discover.Workload `json:"workload"`
USDMonth float64 `json:"usdMonth"`
Minutes int `json:"minutes"`
}
Small is a workload left out at its recommended window (Minutes) for saving less than --min-saving a month, with what it would add.
type TagCriterion ¶
TagCriterion is one --exclude-tags criterion: its keys in the order given (as Node's object keeps them), each with the values it accepts.
type Totals ¶
type Totals struct {
Workloads int `json:"workloads"`
Kinds Kinds `json:"kinds"`
Excluded int `json:"excluded"`
Databases int `json:"databases"`
ActualMonth float64 `json:"actualMonth"`
USDMonthWindow float64 `json:"usdMonthWindow"`
USDMonthRecommended float64 `json:"usdMonthRecommended"`
DormetoMonth float64 `json:"dormetoMonth"`
WithDormetoMonth float64 `json:"withDormetoMonth"`
}
Totals are the figures of some workloads (all, an account's, a region's). Excluded: the workloads not estimated, whatever the reason (tags, left out, too many wakes, too small a saving). WithDormetoMonth: the actual cost less the savings at the report's window (--window, else each workload's recommended one), plus Dormeto's cost (an account's: its routers and workloads; the total's: the manager too).
type UnreadableCluster ¶
type UnreadableCluster struct {
Account string `json:"account"`
Region string `json:"region"`
Name string `json:"name"`
Reason string `json:"reason"`
}
UnreadableCluster is an EKS cluster the profile cannot read (R10.5): its workloads are not estimated.
type Uptime ¶
type Uptime struct {
HoursPerDay *float64 `json:"hoursPerDay,omitempty"`
Unreadable *string `json:"unreadable,omitempty"`
// Go only: an ECS service's average number of tasks while it ran (its LiveTaskCount), the count it is priced at;
// none, its count when discovered (one task found at 0).
Tasks *float64 `json:"tasks,omitempty"`
}
Uptime is a measured uptime: the hours it ran a day, or why it is unknown (then all the time). One of the two is set.
type WorkloadEstimate ¶
type WorkloadEstimate struct {
Workload discover.Workload `json:"workload"`
// No request in the days read (--days).
Quiet bool `json:"quiet"`
// What its naps would stop, running every hour of the baseline (or, measured, the hours it ran): its cost a month
// now.
ActualMonth float64 `json:"actualMonth"`
// An EC2 instance without an Auto Scaling group (--ec2-uptime) or an ECS service (--ecs-uptime): the hours it ran a
// day, or why they are unknown (then 24/7).
Uptime *Uptime `json:"uptime,omitempty"`
AtWindow AtWindow `json:"atWindow"`
Recommended Recommended `json:"recommended"`
// Its companion databases, napped with it: their saving (included in the workload's) at the report's window and at
// its recommended one.
Databases []Companion `json:"databases,omitempty"`
}
WorkloadEstimate is a workload estimated.