CI
Report CI job usage
Stores the CPU and memory one GitHub Actions job used, as measured by the costgraph-action usage step, so jobs on runners AutoPilot did not launch show usage too. Needs a token from GitHub Actions sign-in requested in that job: the repository, run, attempt and job come from the token, not the body. A final report replaces a running one, a running report never replaces a final one, and usage measured by a runner AutoPilot launched is kept over the step’s. stored is false when the report was not kept.
POST
/
api
/
v1
/
tenant
/
ci
/
autopilot
/
usage
Report CI job usage
curl --request POST \
--url https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"arch": "<string>",
"cgroup": "<string>",
"cpu_avg_cores": 123,
"cpu_p50": 123,
"cpu_p90": 123,
"cpu_p95": 123,
"cpu_p99": 123,
"cpu_peak_cores": 123,
"cpu_total_cores": 123,
"disk_read_bytes": 123,
"disk_write_bytes": 123,
"egress": [
{
"bytes_in": 123,
"bytes_out": 123,
"destination": "<string>",
"points": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"port": "<string>"
}
],
"egress_other": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"ended_at": "<string>",
"final": true,
"job_id": 123,
"kernel": "<string>",
"memory_peak_bytes": 123,
"memory_total_bytes": 123,
"net_in_bytes": 123,
"net_out_bytes": 123,
"oom_kills": 123,
"run_attempt": 123,
"run_id": 123,
"samples": 123,
"series": [
{
"cpu": 123,
"mem": 123,
"t": 123
}
],
"source": "<string>",
"started_at": "<string>",
"version": 123
}
'import requests
url = "https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage"
payload = {
"arch": "<string>",
"cgroup": "<string>",
"cpu_avg_cores": 123,
"cpu_p50": 123,
"cpu_p90": 123,
"cpu_p95": 123,
"cpu_p99": 123,
"cpu_peak_cores": 123,
"cpu_total_cores": 123,
"disk_read_bytes": 123,
"disk_write_bytes": 123,
"egress": [
{
"bytes_in": 123,
"bytes_out": 123,
"destination": "<string>",
"points": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"port": "<string>"
}
],
"egress_other": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"ended_at": "<string>",
"final": True,
"job_id": 123,
"kernel": "<string>",
"memory_peak_bytes": 123,
"memory_total_bytes": 123,
"net_in_bytes": 123,
"net_out_bytes": 123,
"oom_kills": 123,
"run_attempt": 123,
"run_id": 123,
"samples": 123,
"series": [
{
"cpu": 123,
"mem": 123,
"t": 123
}
],
"source": "<string>",
"started_at": "<string>",
"version": 123
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
arch: '<string>',
cgroup: '<string>',
cpu_avg_cores: 123,
cpu_p50: 123,
cpu_p90: 123,
cpu_p95: 123,
cpu_p99: 123,
cpu_peak_cores: 123,
cpu_total_cores: 123,
disk_read_bytes: 123,
disk_write_bytes: 123,
egress: [
{
bytes_in: 123,
bytes_out: 123,
destination: '<string>',
points: [{in: 123, out: 123, t: 123}],
port: '<string>'
}
],
egress_other: [{in: 123, out: 123, t: 123}],
ended_at: '<string>',
final: true,
job_id: 123,
kernel: '<string>',
memory_peak_bytes: 123,
memory_total_bytes: 123,
net_in_bytes: 123,
net_out_bytes: 123,
oom_kills: 123,
run_attempt: 123,
run_id: 123,
samples: 123,
series: [{cpu: 123, mem: 123, t: 123}],
source: '<string>',
started_at: '<string>',
version: 123
})
};
fetch('https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage', 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/ci/autopilot/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'arch' => '<string>',
'cgroup' => '<string>',
'cpu_avg_cores' => 123,
'cpu_p50' => 123,
'cpu_p90' => 123,
'cpu_p95' => 123,
'cpu_p99' => 123,
'cpu_peak_cores' => 123,
'cpu_total_cores' => 123,
'disk_read_bytes' => 123,
'disk_write_bytes' => 123,
'egress' => [
[
'bytes_in' => 123,
'bytes_out' => 123,
'destination' => '<string>',
'points' => [
[
'in' => 123,
'out' => 123,
't' => 123
]
],
'port' => '<string>'
]
],
'egress_other' => [
[
'in' => 123,
'out' => 123,
't' => 123
]
],
'ended_at' => '<string>',
'final' => true,
'job_id' => 123,
'kernel' => '<string>',
'memory_peak_bytes' => 123,
'memory_total_bytes' => 123,
'net_in_bytes' => 123,
'net_out_bytes' => 123,
'oom_kills' => 123,
'run_attempt' => 123,
'run_id' => 123,
'samples' => 123,
'series' => [
[
'cpu' => 123,
'mem' => 123,
't' => 123
]
],
'source' => '<string>',
'started_at' => '<string>',
'version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage"
payload := strings.NewReader("{\n \"arch\": \"<string>\",\n \"cgroup\": \"<string>\",\n \"cpu_avg_cores\": 123,\n \"cpu_p50\": 123,\n \"cpu_p90\": 123,\n \"cpu_p95\": 123,\n \"cpu_p99\": 123,\n \"cpu_peak_cores\": 123,\n \"cpu_total_cores\": 123,\n \"disk_read_bytes\": 123,\n \"disk_write_bytes\": 123,\n \"egress\": [\n {\n \"bytes_in\": 123,\n \"bytes_out\": 123,\n \"destination\": \"<string>\",\n \"points\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"port\": \"<string>\"\n }\n ],\n \"egress_other\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"ended_at\": \"<string>\",\n \"final\": true,\n \"job_id\": 123,\n \"kernel\": \"<string>\",\n \"memory_peak_bytes\": 123,\n \"memory_total_bytes\": 123,\n \"net_in_bytes\": 123,\n \"net_out_bytes\": 123,\n \"oom_kills\": 123,\n \"run_attempt\": 123,\n \"run_id\": 123,\n \"samples\": 123,\n \"series\": [\n {\n \"cpu\": 123,\n \"mem\": 123,\n \"t\": 123\n }\n ],\n \"source\": \"<string>\",\n \"started_at\": \"<string>\",\n \"version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"arch\": \"<string>\",\n \"cgroup\": \"<string>\",\n \"cpu_avg_cores\": 123,\n \"cpu_p50\": 123,\n \"cpu_p90\": 123,\n \"cpu_p95\": 123,\n \"cpu_p99\": 123,\n \"cpu_peak_cores\": 123,\n \"cpu_total_cores\": 123,\n \"disk_read_bytes\": 123,\n \"disk_write_bytes\": 123,\n \"egress\": [\n {\n \"bytes_in\": 123,\n \"bytes_out\": 123,\n \"destination\": \"<string>\",\n \"points\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"port\": \"<string>\"\n }\n ],\n \"egress_other\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"ended_at\": \"<string>\",\n \"final\": true,\n \"job_id\": 123,\n \"kernel\": \"<string>\",\n \"memory_peak_bytes\": 123,\n \"memory_total_bytes\": 123,\n \"net_in_bytes\": 123,\n \"net_out_bytes\": 123,\n \"oom_kills\": 123,\n \"run_attempt\": 123,\n \"run_id\": 123,\n \"samples\": 123,\n \"series\": [\n {\n \"cpu\": 123,\n \"mem\": 123,\n \"t\": 123\n }\n ],\n \"source\": \"<string>\",\n \"started_at\": \"<string>\",\n \"version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"arch\": \"<string>\",\n \"cgroup\": \"<string>\",\n \"cpu_avg_cores\": 123,\n \"cpu_p50\": 123,\n \"cpu_p90\": 123,\n \"cpu_p95\": 123,\n \"cpu_p99\": 123,\n \"cpu_peak_cores\": 123,\n \"cpu_total_cores\": 123,\n \"disk_read_bytes\": 123,\n \"disk_write_bytes\": 123,\n \"egress\": [\n {\n \"bytes_in\": 123,\n \"bytes_out\": 123,\n \"destination\": \"<string>\",\n \"points\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"port\": \"<string>\"\n }\n ],\n \"egress_other\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"ended_at\": \"<string>\",\n \"final\": true,\n \"job_id\": 123,\n \"kernel\": \"<string>\",\n \"memory_peak_bytes\": 123,\n \"memory_total_bytes\": 123,\n \"net_in_bytes\": 123,\n \"net_out_bytes\": 123,\n \"oom_kills\": 123,\n \"run_attempt\": 123,\n \"run_id\": 123,\n \"samples\": 123,\n \"series\": [\n {\n \"cpu\": 123,\n \"mem\": 123,\n \"t\": 123\n }\n ],\n \"source\": \"<string>\",\n \"started_at\": \"<string>\",\n \"version\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"stored": true
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Body
application/json
Usage line written by costgraph-agent ci
Was this page helpful?
⌘I
Report CI job usage
curl --request POST \
--url https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"arch": "<string>",
"cgroup": "<string>",
"cpu_avg_cores": 123,
"cpu_p50": 123,
"cpu_p90": 123,
"cpu_p95": 123,
"cpu_p99": 123,
"cpu_peak_cores": 123,
"cpu_total_cores": 123,
"disk_read_bytes": 123,
"disk_write_bytes": 123,
"egress": [
{
"bytes_in": 123,
"bytes_out": 123,
"destination": "<string>",
"points": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"port": "<string>"
}
],
"egress_other": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"ended_at": "<string>",
"final": true,
"job_id": 123,
"kernel": "<string>",
"memory_peak_bytes": 123,
"memory_total_bytes": 123,
"net_in_bytes": 123,
"net_out_bytes": 123,
"oom_kills": 123,
"run_attempt": 123,
"run_id": 123,
"samples": 123,
"series": [
{
"cpu": 123,
"mem": 123,
"t": 123
}
],
"source": "<string>",
"started_at": "<string>",
"version": 123
}
'import requests
url = "https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage"
payload = {
"arch": "<string>",
"cgroup": "<string>",
"cpu_avg_cores": 123,
"cpu_p50": 123,
"cpu_p90": 123,
"cpu_p95": 123,
"cpu_p99": 123,
"cpu_peak_cores": 123,
"cpu_total_cores": 123,
"disk_read_bytes": 123,
"disk_write_bytes": 123,
"egress": [
{
"bytes_in": 123,
"bytes_out": 123,
"destination": "<string>",
"points": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"port": "<string>"
}
],
"egress_other": [
{
"in": 123,
"out": 123,
"t": 123
}
],
"ended_at": "<string>",
"final": True,
"job_id": 123,
"kernel": "<string>",
"memory_peak_bytes": 123,
"memory_total_bytes": 123,
"net_in_bytes": 123,
"net_out_bytes": 123,
"oom_kills": 123,
"run_attempt": 123,
"run_id": 123,
"samples": 123,
"series": [
{
"cpu": 123,
"mem": 123,
"t": 123
}
],
"source": "<string>",
"started_at": "<string>",
"version": 123
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
arch: '<string>',
cgroup: '<string>',
cpu_avg_cores: 123,
cpu_p50: 123,
cpu_p90: 123,
cpu_p95: 123,
cpu_p99: 123,
cpu_peak_cores: 123,
cpu_total_cores: 123,
disk_read_bytes: 123,
disk_write_bytes: 123,
egress: [
{
bytes_in: 123,
bytes_out: 123,
destination: '<string>',
points: [{in: 123, out: 123, t: 123}],
port: '<string>'
}
],
egress_other: [{in: 123, out: 123, t: 123}],
ended_at: '<string>',
final: true,
job_id: 123,
kernel: '<string>',
memory_peak_bytes: 123,
memory_total_bytes: 123,
net_in_bytes: 123,
net_out_bytes: 123,
oom_kills: 123,
run_attempt: 123,
run_id: 123,
samples: 123,
series: [{cpu: 123, mem: 123, t: 123}],
source: '<string>',
started_at: '<string>',
version: 123
})
};
fetch('https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage', 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/ci/autopilot/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'arch' => '<string>',
'cgroup' => '<string>',
'cpu_avg_cores' => 123,
'cpu_p50' => 123,
'cpu_p90' => 123,
'cpu_p95' => 123,
'cpu_p99' => 123,
'cpu_peak_cores' => 123,
'cpu_total_cores' => 123,
'disk_read_bytes' => 123,
'disk_write_bytes' => 123,
'egress' => [
[
'bytes_in' => 123,
'bytes_out' => 123,
'destination' => '<string>',
'points' => [
[
'in' => 123,
'out' => 123,
't' => 123
]
],
'port' => '<string>'
]
],
'egress_other' => [
[
'in' => 123,
'out' => 123,
't' => 123
]
],
'ended_at' => '<string>',
'final' => true,
'job_id' => 123,
'kernel' => '<string>',
'memory_peak_bytes' => 123,
'memory_total_bytes' => 123,
'net_in_bytes' => 123,
'net_out_bytes' => 123,
'oom_kills' => 123,
'run_attempt' => 123,
'run_id' => 123,
'samples' => 123,
'series' => [
[
'cpu' => 123,
'mem' => 123,
't' => 123
]
],
'source' => '<string>',
'started_at' => '<string>',
'version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage"
payload := strings.NewReader("{\n \"arch\": \"<string>\",\n \"cgroup\": \"<string>\",\n \"cpu_avg_cores\": 123,\n \"cpu_p50\": 123,\n \"cpu_p90\": 123,\n \"cpu_p95\": 123,\n \"cpu_p99\": 123,\n \"cpu_peak_cores\": 123,\n \"cpu_total_cores\": 123,\n \"disk_read_bytes\": 123,\n \"disk_write_bytes\": 123,\n \"egress\": [\n {\n \"bytes_in\": 123,\n \"bytes_out\": 123,\n \"destination\": \"<string>\",\n \"points\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"port\": \"<string>\"\n }\n ],\n \"egress_other\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"ended_at\": \"<string>\",\n \"final\": true,\n \"job_id\": 123,\n \"kernel\": \"<string>\",\n \"memory_peak_bytes\": 123,\n \"memory_total_bytes\": 123,\n \"net_in_bytes\": 123,\n \"net_out_bytes\": 123,\n \"oom_kills\": 123,\n \"run_attempt\": 123,\n \"run_id\": 123,\n \"samples\": 123,\n \"series\": [\n {\n \"cpu\": 123,\n \"mem\": 123,\n \"t\": 123\n }\n ],\n \"source\": \"<string>\",\n \"started_at\": \"<string>\",\n \"version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"arch\": \"<string>\",\n \"cgroup\": \"<string>\",\n \"cpu_avg_cores\": 123,\n \"cpu_p50\": 123,\n \"cpu_p90\": 123,\n \"cpu_p95\": 123,\n \"cpu_p99\": 123,\n \"cpu_peak_cores\": 123,\n \"cpu_total_cores\": 123,\n \"disk_read_bytes\": 123,\n \"disk_write_bytes\": 123,\n \"egress\": [\n {\n \"bytes_in\": 123,\n \"bytes_out\": 123,\n \"destination\": \"<string>\",\n \"points\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"port\": \"<string>\"\n }\n ],\n \"egress_other\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"ended_at\": \"<string>\",\n \"final\": true,\n \"job_id\": 123,\n \"kernel\": \"<string>\",\n \"memory_peak_bytes\": 123,\n \"memory_total_bytes\": 123,\n \"net_in_bytes\": 123,\n \"net_out_bytes\": 123,\n \"oom_kills\": 123,\n \"run_attempt\": 123,\n \"run_id\": 123,\n \"samples\": 123,\n \"series\": [\n {\n \"cpu\": 123,\n \"mem\": 123,\n \"t\": 123\n }\n ],\n \"source\": \"<string>\",\n \"started_at\": \"<string>\",\n \"version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/ci/autopilot/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"arch\": \"<string>\",\n \"cgroup\": \"<string>\",\n \"cpu_avg_cores\": 123,\n \"cpu_p50\": 123,\n \"cpu_p90\": 123,\n \"cpu_p95\": 123,\n \"cpu_p99\": 123,\n \"cpu_peak_cores\": 123,\n \"cpu_total_cores\": 123,\n \"disk_read_bytes\": 123,\n \"disk_write_bytes\": 123,\n \"egress\": [\n {\n \"bytes_in\": 123,\n \"bytes_out\": 123,\n \"destination\": \"<string>\",\n \"points\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"port\": \"<string>\"\n }\n ],\n \"egress_other\": [\n {\n \"in\": 123,\n \"out\": 123,\n \"t\": 123\n }\n ],\n \"ended_at\": \"<string>\",\n \"final\": true,\n \"job_id\": 123,\n \"kernel\": \"<string>\",\n \"memory_peak_bytes\": 123,\n \"memory_total_bytes\": 123,\n \"net_in_bytes\": 123,\n \"net_out_bytes\": 123,\n \"oom_kills\": 123,\n \"run_attempt\": 123,\n \"run_id\": 123,\n \"samples\": 123,\n \"series\": [\n {\n \"cpu\": 123,\n \"mem\": 123,\n \"t\": 123\n }\n ],\n \"source\": \"<string>\",\n \"started_at\": \"<string>\",\n \"version\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"stored": true
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}