Kubernetes clusters
Get kubernetes cluster workload container metrics
Returns time-series for a single workload container - CPU usage, memory usage, CPU throttle ratio, PVC disk read, write and aggregated throughput, and PVC disk read, write and aggregated IOPS - pooled across the workload’s replicas, and, where the accelerator exporter attributes a device to this container, the device’s utilisation, memory and power, how many devices the container holds, and whether it holds them exclusively, for the tenant selected by the X-CostGraph-Tenant-ID header
GET
/
api
/
v1
/
tenant
/
clusters
/
{cluster_id}
/
workloads
/
{resource_id}
/
containers
/
{container_name}
/
metrics
Get kubernetes cluster workload container metrics
curl --request GET \
--url https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics \
--header 'Authorization: <api-key>' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>'import requests
url = "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics"
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>', Authorization: '<api-key>'}
};
fetch('https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"api_version": "<string>",
"container_name": "<string>",
"cpu_throttle": [
{
"t": 123,
"v": 123
}
],
"cpu_usage": [
{
"t": 123,
"v": 123
}
],
"end": "<string>",
"gpu_availability": {},
"gpu_memory_used_mib": [
{
"t": 123,
"v": 123
}
],
"gpu_memory_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_watts": [
{
"t": 123,
"v": 123
}
],
"gpu_utilization": [
{
"t": 123,
"v": 123
}
],
"iops": [
{
"t": 123,
"v": 123
}
],
"memory_usage": [
{
"t": 123,
"v": 123
}
],
"namespace": "<string>",
"read_iops": [
{
"t": 123,
"v": 123
}
],
"read_throughput": [
{
"t": 123,
"v": 123
}
],
"resource_id": "<string>",
"start": "<string>",
"step_seconds": 123,
"throughput": [
{
"t": 123,
"v": 123
}
],
"workload_kind": "<string>",
"workload_name": "<string>",
"write_iops": [
{
"t": 123,
"v": 123
}
],
"write_throughput": [
{
"t": 123,
"v": 123
}
],
"gpu_device_exclusive": true,
"gpu_devices_held": 123,
"gpu_identity_source": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Headers
Tenant ID
Path Parameters
Kubernetes cluster ID
Kubernetes workload resource ID
Container name
Was this page helpful?
⌘I
Get kubernetes cluster workload container metrics
curl --request GET \
--url https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics \
--header 'Authorization: <api-key>' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>'import requests
url = "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics"
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>', Authorization: '<api-key>'}
};
fetch('https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/workloads/{resource_id}/containers/{container_name}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"api_version": "<string>",
"container_name": "<string>",
"cpu_throttle": [
{
"t": 123,
"v": 123
}
],
"cpu_usage": [
{
"t": 123,
"v": 123
}
],
"end": "<string>",
"gpu_availability": {},
"gpu_memory_used_mib": [
{
"t": 123,
"v": 123
}
],
"gpu_memory_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_watts": [
{
"t": 123,
"v": 123
}
],
"gpu_utilization": [
{
"t": 123,
"v": 123
}
],
"iops": [
{
"t": 123,
"v": 123
}
],
"memory_usage": [
{
"t": 123,
"v": 123
}
],
"namespace": "<string>",
"read_iops": [
{
"t": 123,
"v": 123
}
],
"read_throughput": [
{
"t": 123,
"v": 123
}
],
"resource_id": "<string>",
"start": "<string>",
"step_seconds": 123,
"throughput": [
{
"t": 123,
"v": 123
}
],
"workload_kind": "<string>",
"workload_name": "<string>",
"write_iops": [
{
"t": 123,
"v": 123
}
],
"write_throughput": [
{
"t": 123,
"v": 123
}
],
"gpu_device_exclusive": true,
"gpu_devices_held": 123,
"gpu_identity_source": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}