The Assets API retrieves backing cost data broken down by individual assets in your cluster but also provides various aggregations of this data.
The API is available at the following endpoint:
Here are example uses:
API parameters include the following:
windowdictates the applicable window for measuring historical asset cost. Currently, supported options are as follows:
- "15m", "24h", "7d", "48h", etc.
- "today", "yesterday", "week", "month", "lastweek", "lastmonth"
- "1586822400,1586908800", etc. (start and end unix timestamps)
- "2020-04-01T00:00:00Z,2020-04-03T00:00:00Z", etc. (start and end UTC RFC3339 pairs)
aggregateis used to consolidate cost model data. Supported aggregation types are cluster and type. Passing an empty value for this parameter, or not passing one at all, returns data by an individual asset.
accumulatewhen set to false this endpoint returns daily time series data vs cumulative data. Default value is false.
disableAdjustmentswhen set to true, zeros out all adjustments from cloud provider reconciliation, which would otherwise change the totalCost.
formatwhen set to
csv, will download an accumulated version of the asset results in CSV format. By default, results will be in JSON format.
This API returns a set of JSON objects in this format:
cluster: "cluster-one" // parent cluster for asset
cpuCores: 2 // number of CPUs, given this is a node asset type
cpuCost: 0.047416 // cumulative cost of CPU measured over time window
discount: 0.3 // discount applied to asset cost
end: "2020-08-21T00:00:00+0000" // end of measured time window
adjustment: 0.0023 // amount added to totalCost during reconciliation with cloud provider data
totalCost: 0.049434 // total asset cost after applied discount
type: "node" // e.g. node, disk, cluster management fee, etc
Optional filter parameters take the format of
&<filter>=<value>appended to the assets URL query and include the following:
- Some filters require cloud configuration, which can be set at
- Multiple filter selections evaluate as ANDs. Each filter selection accepts comma-separated values that evaluate as ORs.
- For example, including both
filterNames=name1,name2logically evaluates as
(cluster == cluster-one) && (name == name1 || name == name2)
- All filters are case-sensitive except for
- All filters accept wildcard filters denoted by a URL-encoded
*suffix, except for
filterTypesand the label key in
- For example,
filterProviderIDs=gke%2Awill return all assets with a
gkestring prefix in its Provider ID.
- For example,
filterLabels=deployment%3Dkube%2Awill return all assets with
deploymentlabel value containing a
- Invalid filters return no assets.