Report API
Summary
The report endpoint replaces functions earlier split across a variety of container APIs. This provides a singular view of the data powering the container insights.
This endpoint allows analysis of data by specifying aggregated metrics combined with groups and filters for gathering cost.
End point
/containers/report
| Parameter | Required | Description | Default | Allowed |
|---|---|---|---|---|
| viewId | No | Cloudability view identifier passed to enable filtering by account identifiers,. | Default view identifier for the Organization. | 0 (all if permitted), any configured numeric value. |
Request Body
The report request body is a JSON object consisting of:
| Parameter | Required | Type | Example | Supported Values |
|---|---|---|---|---|
| start | Yes | Date | 2024-06-01 | Any date after 2022-01-01 |
| end | Yes | Date | 2024-06-02 | Any date after 2022-01-01, must be greater than or equal to start date |
| costType | Yes | String | adjusted | See: Supported Cost Types. |
| metrics | Yes | List of strings | ["total_cost", "total_cost_efficiency"] | See: Supported Metric Values. |
| limit | Yes | Integer | 10 | 1-1000 |
| widgetType | Type | String | top | See: Supported Widget Types. |
| count | No | List of strings | ["cluster"] | See: Supported Group, Count and Filter Values. |
| group | No | List of strings | ["cluster"] | See: Supported Group, Count and Filter Values. |
| filters | No | List of strings | ["cluster=={cluster_uuid}"] | See: Supported Group, Count and Filter Values. |
| sort | No | List of configurations | [{"sortMetric":"total_cost","sortOrder":" desc"}] | See: Supported Sort Configuration. |
| paginationToken | No | String | See: Pagination. |
Supported Cost Types
| Sort Type | Relation to Containers UI |
|---|---|
| adjusted | Cash |
| total_adjusted_amortized | Adjusted Amortized |
Supported Metric Values
| Metric | Standard Cost Metric | Standard Usage Metric | Notes |
|---|---|---|---|
| cpu/reserved | Yes | Yes | Evaluated as the maximum of requested and utilized resources. |
| memory/reserved | Yes | Yes | Evaluated as the maximum of requested and utilized resources. |
| network/rx | Yes | Yes | Fairshare values equal Allocated values. |
| network/tx | Yes | Yes | Fairshare values are Allocated values. |
| filesystem/usage | Yes | Yes | |
| persistent_volume/usage | Yes | Yes | Usage is determined based on the requested size of the PV in a 1:1 ratio with a PVC. |
| gpu/reserved | Yes | Yes | Fairshare values equal Allocated values. |
| miscellaneous | Yes | No | This is a cost-only metric. |
Request-table fields
| Field Name | Field Type | Supported Metrics | Meaning |
|---|---|---|---|
| total_cost_fairshare | Aggregated | N/A | Total fairshare cost across all metric types. This represents the aggregated underlying costs of all resources contributing to the query. |
| total_cost_allocated | Aggregated | N/A | Total allocated cost across all metric types. This represents the utilized cost of all resources contributed to the query. |
| total_cost_idle | Aggregated | N/A | Total idle cost across all metric types calculated via total_cost_fairshare and total_cost_allocated' |
| total_cost_efficiency | Aggregated | N/A | Total cost efficiency across all metric types, calculated via total_cost_allocated / total_cost_fair share. |
| usage_cost_efficiency | Aggregated | N/A | Usage cost efficiency across all metric types, calculated as a ratio of usage cost / total_cost_allocated. |
| {metric} /usage_cost_allocated | Per Metric | cpu, memory | Usage cost per metric. |
| {metric} /usage_cost_efficiency | Per Metric | cpu, memory | Usage cost efficiency per metric, calculated as a ratio of usage cost / total_cost_allocated. |
| {metric}/request | Per Metric | cpu, memory, gpu | Amount of resources requested. |
| {metric}/usage | Per Metric | cpu, memory, gpu | Amount of resources utilized. |
| {metric}/limit | Per Metric | cpu, memory, gpu | Limit on resources, 0 indicates no limit has been set. |
| {metric}_cost_fairshare | Per Metric | Standard cost metrics | Fairshare cost representation of the metric usage. |
| {metric}_cost_allocated | Per Metric | Standard cost metrics | Allocated cost representation of the metric usage. |
| {metric}_cost_idle | Per Metric | Standard cost metrics | Fairshare - allocated cost representation of the metric. |
| {metric}_cost_efficiency | Per Metric | Standard cost metrics | Allocated/ Fairshare cost value. |
| {metric} _utilization_fairshare | Per Metric | Standard cost metrics | Fairshare utilization value. |
| {metric} _utilization_allocated | Per Metric | Standard cost metrics | Allocated utilization value. |
| {metric}_utilization_idle | Per Metric | Standard cost metrics | Fairshare - Allocated utilization |
| {metric} _utilization_efficiency | Per Metric | Standard cost metrics | Allocated/ Fairshare utilization value. |
Supported Widget Types
| Widget Type | Relation to Containers UI | Meaning | Requirements | Restrictions |
|---|---|---|---|---|
| top | Table Data | This is the most common representation of containers data which returns aggregated data over the specified time period. | Group must not contain a time period. | |
| kpi | KPI Widgets | This provides a singular value back. | Single result only. Group is not available Pagination is not available. |
|
| bar | Bar Charts | This provides a set of top/ bottom values without generating continuous series of data across the time period. | A time group must be set (ex: day). | Pagination is not available. |
| line | Line Charts | This returns the top/ bottom continuous series of data across the time period. | A time group must be set (ex: day). | Pagination is not available. |
Supported Group, Count and Filter Values
Groups, Counts, and Filters share a overlapping set of accessible data, which can be utilized as:
- Groups returning results aggregated by unique values in that field. For example, grouping by cluster would return a result set that is isolated by cluster.
- Counts returning a result section identifying the number of unique entries. For example, a count of namespaces would return the total number of namespaces within the selection.
- Filters allowing a user to limit the result set to a subset of results. For example, supplying a filter of workload_type==deployment would only return results for workloads identified as being owned by a deployment.
| Value | Meaning | Example Returned Values | Supports Filter | Supports Group | Supports Count |
|---|---|---|---|---|---|
| cluster | Cluster unique identifier. A full set of these with name mappings can be retrieved from the clusters endpoint. | XXXXXXX-XXXX-XXXX-XXXXXXXXXXXXXXXX | Yes | Yes | Yes |
| day | Allows for grouping data by day. This must be used with a supported widgetType (bar/line). | 2024-06-01 | No | No | No |
| workload_type | Highest level workload owner type. | deployment, cronjob, statefulset, etc | Yes | Yes | Yes |
| workload_name | Highest level workload owner name. | my-service-name | Yes | Yes | Yes |
| namespace | Namespace where workloads are present. | my-namespace-name | Yes | Yes | Yes |
| container | Container name running on the cluster. | my-container-name | Yes | Yes | Yes |
| pod | Pod name running on the cluster. | my-pod-name | Yes | Yes | Yes |
| node | Assigned node name. | ip-1.2.3.4.region.compute.internal | Yes | Yes | Yes |
| node_id | Provider node identifier. | aws:///region/i-1234 | Yes | Yes | Yes |
| instance_family | Instance family of the underlying node. | t2 | Yes | Yes | Yes |
| instance_category | Instance category of the underlying node. | General Purpose | Yes | Yes | Yes |
| instance_type | Instance type of the underlying node. | t2.micro | Yes | Yes | Yes |
| savings_plan | Savings plan type applied to the underlying node. | ComputeSavingsPlan | Yes | Yes | Yes |
| lease_type | Lease method of the underlying node. | On-Demand | Yes | Yes | Yes |
| reserved_instance | If the underlying node is running as part of a reserved instance commitment, | Y, N | Yes | Yes | Yes |
| cpu_allocatable | CPU units (in microcore), available on the underlying node. | 48000000 | Yes | Yes | Yes |
| memory_allocatable | Memory (in bytes) available on the underlying node. | 1000000000 | Yes | Yes | Yes |
| gpu_allocatable | GPU units (in microgpu), available on the underlying node. | 1000000 | Yes | Yes | Yes |
| region | Region in which the underlying node is running. | us-west-2 | Yes | Yes | Yes |
| zone | Availability zone in which the underlying node is running. | us-west-2a | Yes | Yes | Yes |
| node_group | Node group (if detectable), which the underlying node belongs to. | my-node-group | Yes | Yes | Yes |
| vendor | Cloud provider for the running cluster. | aws, azure, etc | Yes | No | No |
| cluster_type | Type of cluster. | eks, gke, openshift, etc | Yes | No | No |
Using Filters
Filters can be configured by:
- Filtered Attribute: Any value denoted as filterable in the table.
- Operator
- ==Equals (case sensitive)
- []=One of (case sensitive)
- Filtered Value: Values that the user wants to filter upon.
Examples: namespace==kube-system filters results to only show data for kube-system.
workload_type[]=cronjob,job filters results to only show data for cronjobs or jobs,
The sort feature sorts out data by the first specified metric column in descending order by default. You can set this up to ensure pagination is always possible.
You can sort values in any order, specifying the requested metric value.
The example below sorts rows by efficiency in descending order, and then by total_cost in descending order.
[
{
"sortMetric": "total_cost_efficiency",
"sortOrder": "desc"
},
{
"sortMetric": "total_cost",
"sortOrder": "desc"
}
]
Pagination
| Field | Type | Description |
|---|---|---|
| result.pagination.hasNext | Boolean | Indicates the availability of a following page. |
| result.pagination.nextToken | String | Provides a string value for passing back to the API to retrieve the next set of results. |
If the above data for pagination indicates that another page is available for consumption, then the value in nextToken can be passed back into the API via the pagination Token parameter.
Do not change the request to avoid errors and inconsistent results.
Example Request
[
curl --location 'https://api.usgov.cloudability.com/v3/containers/report?pretty=true' \
-H "apptio-opentoken: ${token}" \
-H "apptio-environmentid: ${env_id}"
-H "Content-type: application/json" \
--data '{
"start": "2025-08-01",
"end": "2025-08-05",
"costType": "adjusted",
"metrics": [
"total_cost_fairshare"
],
"group": [
"namespace"
],
"sort": [
{
"sortMetric": "total_cost_fairshare",
"sortOrder": "desc"
}
],
"widgetType": "top",
"limit": 1
}'
Sample Response
[
{
"result": {
"data": [
{
"dimensions": {
"namespace": "cloudability"
},
"metrics": {
"total_cost_fairshare": {
"unit": "currency",
"values": [
7.996368043
]
}
}
}
],
"pagination": {
"hasNext": true,
"nextToken": "veryLongPaginationToken"
}
}
}
The response body consists of :
| Field | Type | Meaning |
|---|---|---|
| result.data | []object | The primary response body containing a series of elements identified by the requested group values. |
| result.data[N].count | []map [string] string | Represents a set of objects containing the requested unique count of values. |
| result.data[N].dimensions | map[string] string | Represents the grouped attributes. |
| result.data[N].metrics | map[string] object | Represents the aggregated metric values. When grouping by time, each time unit is listed as an index in the values array |
| result.data[N].metrics. {metric}.unit | string | The specific unit for the metric type, possible values: currency, bytes, microcpu, microgpu, efficiency. |
| result.data[N].metrics. {metric}.values | []float64 | Represents the utilized resources over the time period. For example, while grouping by days, each entry in the array represents a single day. |