Allocation Trends API
The Trends API determines changes in resource cost usage over time based on the interval set
windowparameter and provides that information via the schema field
value. Cost usage for the current window sampled will be compared with the previous window, the window directly before the current window of the same size interval. For example, for
window=3d, Kubecost will output cost usage for the past three days compared to cost usage of the three days before the start of the window. This means a total of six days of allocation are sampled in order to provide an accurate value.
The equation for calculating value is:
value=current/previous - 1
Receiving a positive
valuemeans your more recent
totalCosthas increased compared to the previous window. A negative
valuemeans spending has decreased.
It's important to recognize when a resource is not detected to exist in the previous window. This is designated by the field
IsInfinite=true, which means the allocation could not be determined to exist. Otherwise, the cause of an unexpected or major trend change could be misattributed.
In the example output below,
valueis expressed as 0.11... meaning spending has increased in the current window by roughly 11% from the previous window.
Trend values are converted into percentages in the Kubecost UI. Go to the Allocations page, and manually apply any additional parameters. Trends will be presented in the rightmost column, next to your Total cost. The
windowparameter is determined by the date range icon in the top right of the page. The default is Last 7 days (
window=7d). The equation
value*100is used to provide percentages.
Total cost column
Requests with large time intervals for
windowcan result in an error. The recommended maximum interval for
windowis 7 days. A failed response will show a N/A inside a gray bubble in the UI with no percentage returned.
The Trends API does not currently support cost comparisons besides