After deploying the RealTheory collector to a Kubernetes cluster (See Installing RealTheory in a Cluster), the cluster and its associated objects become available in the RealTheory API within minutes.
Get Daily Cost Report
To get the Daily Cost report data for all stateful sets for a given cluster, call the method below on the K8sReports endpoint.
GET <endpoint>/theory/api/v1/k8sreports/dailycostreport/statefulsets/search/query/{query}/{offset}/{span}?index={index}&count={count}&order={order}&direction={direction}
where
{endpoint}- is the URL of the RealTheory SaaS portal for your account.{query}- is a query used to limit the results to stateful sets for a given cluster.{offset}- is an offset from the current time, in a human readable format, that represents the start of the report data. Supported examples include '24h', '7d', '31d', '365d'{span}- a span of time, in a human readable format, to include in the report data. Supported examples include '24h', '7d', '31d', '365d'{index}- is the starting index of the rows to include in the list. This parameter is optional and defaults to 0 if not specified.{count}- is maximum number of rows to return. This parameter is optional and defaults to 100 if not specified.{order}- is a string containing the name of the attribute to sort on. This parameter is optional. Default value is totalCost.{direction}- is a number that controls the direction of the sort. A value equal to or greater than 0 indicates ascending order; a value less than 0 indicates descending order. This parameter is optional and defaults to -1 if not specified.
Note: All calls to RealTheory APIs must be authenticated and authorized. See Authentication for more details.
Example
GET myendpoint.realtheory.io/theory/api/v1/k8sreports/dailycostreport/statefulsets/search/query/metadata.name=my-statefulset/31d/31d?index=0&count=50&order=totalCost&direction=-1
which returns the first 50 rows for the Daily Cost report for the last 31 days, listing only the stateful sets named my-statefulset, sorted by stateful sets with the highest total cost to the lowest total cost.
Output
Returns an array of StatefulSetItem objects.
[
{
"id": "7ca5298c-2e28-4f31-84ff-a7119787f7d8",
"metadata": {
"id": "7ca5298c-2e28-4f31-84ff-a7119787f7d8",
"name": "my-statefulset",
"clusterId": "8ca6aa4c-8c7d-9fb9-c751-3e038f90d283",
"clusterName": "realtheory-cluster-01",
"customResourceDefinitionId": "00000000-0000-0000-0000-000000000000",
"customResourceDefinitionName": "",
"namespaceId": "c392dd78-b765-41a6-9285-d796cf730fad",
"namespaceName": "realtheory-example",
"customResourceId": "00000000-0000-0000-0000-000000000000",
"customResourceName": "",
"timestamp": "2024-03-08T00:31:27.4975629Z"
},
"totalCost": 5.85435895,
"costs": [
{
"total": 0.19213541,
"cpuUtilization": 11.166667,
"memoryUtilization": 7.7842236,
"utilization": 9.475417,
"efficiency": 10.76,
"timestamp": "2024-02-06T00:00:00Z"
},
{
"total": 0.18412977,
"cpuUtilization": 11.326087,
"memoryUtilization": 7.894035,
"utilization": 9.610435,
"efficiency": 10.914348,
"timestamp": "2024-02-07T00:00:00Z"
},
{
"total": 0.18413823,
"cpuUtilization": 11.282609,
"memoryUtilization": 8.104556,
"utilization": 9.692174,
"efficiency": 10.902174,
"timestamp": "2024-02-08T00:00:00Z"
},
...
],
"clusterName": "realtheory-cluster-01",
"namespaceName": "realtheory-example",
"statefulSetName": "my-statefulset",
"accountName": "RealTheory,Inc.",
"accountOwner": "Joe.Bloggs"
},
...
]
Note: Content has been omitted from the JSON response above for brevity.