Asset Diff API

Asset Diff API

GET http://{kubecost-addresss}/model/assets/diff

The Asset Diff API provides a diff of two windows that returns all the added, removed, or cost changed assets from the later window (before parameter) to the earlier window (after parameter). This endpoint does a comparison of two asset sets in the given windows and accumulates the results.

Path Parameters

{
    ...
    "__undefined__/__undefined__/__undefined__/Storage/__undefined__/Disk/Kubernetes/gke-nick-dev-default-pool-d26dab9e-55qb/gke-nick-dev-default-pool-d26dab9e-55qb":
        {
            Entity: // this is a typical asset
                {
                    type: "Disk",
                    properties: {"category":"Storage","service":"Kubernetes","name":"...","providerID":"..."},
                    labels: {},
                    window: {"start":"2022-07-18T22:00:00Z","end":"2022-07-19T22:00:00Z"},
                    start: "2022-07-18T15:00:00-07:00",
                    end: "2022-07-19T14:43:00-07:00",
                    minutes: 1423.000000,
                    byteHours: 0.00,
                    bytes: 0.00,
                    breakdown: {"idle":0.00,"other":0,"system":0.00,"user":0},
                    adjustment: 0.00,
                    totalCost: 0.00
                },
            Kind: "added" // the type of change ("added", "removed", or "changed")
        }
    ...
}

API Examples

Compare yesterday's assets to today's assets:

http://localhost:9090/model/assets/diff?before=yesterday&after=today

Compare assets from 5 days ago to assets from the last day:

http://localhost:9090/model/assets/diff?before=1d offset 5d&after=1d

Compare assets from last month to assets from this month:

http://localhost:9090/model/assets/diff?before=lastmonth&after=month

Compare assets on 07/01/2022 to assets on 07/06/2022:

http://localhost:9090/model/assets/diff?before=2022-07-01T00:00:00Z,2022-07-02T00:00:00Z&after=2022-07-06T00:00:00Z,2022-07-07T00:00:00Z

Compare yesterday's assets to today's assets, displaying all assets that have a total cost change of 10% or more:

http://localhost:9090/model/assets/diff?before=yesterday&after=today&costChangeRatio=0.1

Last updated