diff --git a/docs/integrations/api-examples.md b/docs/integrations/api-examples.md index 35c701e..6cfbcca 100644 --- a/docs/integrations/api-examples.md +++ b/docs/integrations/api-examples.md @@ -54,7 +54,7 @@ curl -G http://localhost:9003/allocation \ curl -G http://localhost:9003/allocation/compute \ -d window=9d \ -d step=3d \ - -d resolution=10m \ + -d resolution=10m -d aggregate=namespace ``` @@ -81,26 +81,6 @@ curl -G http://localhost:9003/allocation/compute \ } ``` - -### Allocation data with distributed idle costs - -Here's an example of an OpenCost API query that distributes cluster idle costs across all allocations in the cluster: - -```sh -curl -G http://localhost:9003/allocation \ - -d window=1d \ - -d shareIdle=true -``` - -Here's the same query, but distributing the idle costs of each *node* across all allocations on that node: - -```sh -curl -G http://localhost:9003/allocation \ - -d window=1d \ - -d shareIdle=true \ - -d idleByNode=true -``` - ## `/cloudCost` Examples The OpenCost `/cloudCost` API has query parameters for `window`, `aggregate`, and `filter`. Below are several examples of queries using this API. Please refer to the [OpenCost API](api#cloudcost) for the full API specifics. diff --git a/docs/integrations/api.md b/docs/integrations/api.md index ceb1d74..6a5893f 100644 --- a/docs/integrations/api.md +++ b/docs/integrations/api.md @@ -13,7 +13,7 @@ Examples using the API endpoints are provided in the [API Examples](api-examples ## Allocation API -The standard OpenCost API query for costs and resources allocated to Kubernetes workloads based on on-demand list pricing. You may specify the `window` date range, the Kubernetes primitive(s) to `aggregate` on, the `step` for the duration of returned sets, the `resolution` for the duration to use for Prometheus queries, `includeIdle` for whether to include the `__idle__` usage for the cluster, `shareIdle` for whether to distribute idle costs across non-idle allocations, and `idleByNode` for whether to calculate idle costs per node instead of per cluster. +The standard OpenCost API query for costs and resources allocated to Kubernetes workloads based on on-demand list pricing. You may specify the `window` date range, the Kubernetes primitive(s) to `aggregate` on, the `step` for the duration of returned sets, the `resolution` for the duration to use for Prometheus queries, and `includeIdle` for whether to include the `__idle__` usage for the cluster. ### `/allocation` QUERY PARAMETERS @@ -102,7 +102,7 @@ QUERY PARAMETERS - Whether to return the calculated \_\_idle\_\_ field for the query. Default is false. + Whether to return the calculated __idle__ field for the query. Default is false.

Examples:
- - shareIdle - boolean - - - - - Whether to distribute idle costs across non-idle allocations. Default is false. - - When disabled, idle costs are allocated to a separate \_\_idle\_\_ allocation. - When enabled, idle costs are distributed across non-idle allocations. This happens proportionally to the non-idle costs of each allocation. For example, if one allocation has twice as much non-idle costs as another, it also receives twice the amount of idle costs. This calculation happens separately for each resource (like CPU or RAM). - - You can choose to distribute idle costs per cluster or per node using the idleByNode parameter. - -

- Examples:
- - - - - idleByNode - boolean - - - - - Whether to calculate idle costs per node instead of per cluster. Default is false. -

- Examples:
- - - ## Cloud Costs API