Network requests
Network request attribution by connection
Aggregates the tenant's per-request network rows (network_requests_hourly) over the range, joined to the connection each request ran on, into a tree: each client service with its own sums; under it, the server services it reached, each with its own sums; and under each server, its locality rows, one per locality between one client zone and one server zone (client_az, server_az; empty when unknown), each with its own sums. A service seen in two zones is still one client or server row. Captured tag key/value pairs are aggregated at the client, at each server and at each locality row; aggregates of different keys overlap, since a request carrying two tag keys counts under both. Endpoints resolve to service names, and endpoints of one service merge into one row. group_by picks the tag keys aggregated (tag:<key>; empty means every key), group narrows to requests carrying exact tag key/value pairs, and filters (tag:<key>, dst_port, proto) are AND across dimensions and OR within one. Every node carries its previous-window sums and cost change. Limit and offset page the clients. Totals cover the same requests as the tree: those with a connection that carry a shown tag (one of the group_by keys, or any key when group_by is empty), so they equal the sum of every client
POST
/
api
/
v1
/
tenant
/
network
/
requests
/
connections
Network request attribution by connection
curl --request POST \
--url https://api.costgraph.ai/api/v1/tenant/network/requests/connections \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>' \
--data '
{
"filter": {},
"group": {},
"group_by": [
"<string>"
],
"limit": 123,
"offset": 123
}
'import requests
url = "https://api.costgraph.ai/api/v1/tenant/network/requests/connections"
payload = {
"filter": {},
"group": {},
"group_by": ["<string>"],
"limit": 123,
"offset": 123
}
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({filter: {}, group: {}, group_by: ['<string>'], limit: 123, offset: 123})
};
fetch('https://api.costgraph.ai/api/v1/tenant/network/requests/connections', 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/network/requests/connections",
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([
'filter' => [
],
'group' => [
],
'group_by' => [
'<string>'
],
'limit' => 123,
'offset' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/network/requests/connections"
payload := strings.NewReader("{\n \"filter\": {},\n \"group\": {},\n \"group_by\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"offset\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<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/network/requests/connections")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {},\n \"group\": {},\n \"group_by\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"offset\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/network/requests/connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {},\n \"group\": {},\n \"group_by\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"offset\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"changePct": 123,
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"range": {
"end": "<string>",
"start": "<string>"
},
"rows": [
{
"changePct": 123,
"client": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"servers": [
{
"changePct": 123,
"localities": [
{
"changePct": 123,
"client_az": "<string>",
"locality": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"server_az": "<string>",
"tags": [
{
"changePct": 123,
"key": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"value": "<string>"
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
],
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"server": "<string>",
"tags": [
{
"changePct": 123,
"key": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"value": "<string>"
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
],
"tags": [
{
"changePct": 123,
"key": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"value": "<string>"
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
}{
"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
Query Parameters
Cost period; defaults to month_to_date
Available options:
month_to_date, last_7d, last_30d, calendar_month, custom Closed calendar month in YYYY-MM format; required when period=calendar_month
Window start in RFC3339 format; required when period=custom
Window end in RFC3339 format; required when period=custom
Body
application/json
Tag keys to aggregate (group_by, tag:), exact tag pairs to narrow to (group, bare keys), filters as dimension -> values, sort_by (cost|bytes), and client paging via limit (capped) and offset. A negative limit is unpaged. Every field is optional
Was this page helpful?
⌘I
Network request attribution by connection
curl --request POST \
--url https://api.costgraph.ai/api/v1/tenant/network/requests/connections \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>' \
--data '
{
"filter": {},
"group": {},
"group_by": [
"<string>"
],
"limit": 123,
"offset": 123
}
'import requests
url = "https://api.costgraph.ai/api/v1/tenant/network/requests/connections"
payload = {
"filter": {},
"group": {},
"group_by": ["<string>"],
"limit": 123,
"offset": 123
}
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({filter: {}, group: {}, group_by: ['<string>'], limit: 123, offset: 123})
};
fetch('https://api.costgraph.ai/api/v1/tenant/network/requests/connections', 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/network/requests/connections",
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([
'filter' => [
],
'group' => [
],
'group_by' => [
'<string>'
],
'limit' => 123,
'offset' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/network/requests/connections"
payload := strings.NewReader("{\n \"filter\": {},\n \"group\": {},\n \"group_by\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"offset\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<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/network/requests/connections")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {},\n \"group\": {},\n \"group_by\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"offset\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/network/requests/connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {},\n \"group\": {},\n \"group_by\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"offset\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"changePct": 123,
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"range": {
"end": "<string>",
"start": "<string>"
},
"rows": [
{
"changePct": 123,
"client": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"servers": [
{
"changePct": 123,
"localities": [
{
"changePct": 123,
"client_az": "<string>",
"locality": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"server_az": "<string>",
"tags": [
{
"changePct": 123,
"key": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"value": "<string>"
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
],
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"server": "<string>",
"tags": [
{
"changePct": 123,
"key": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"value": "<string>"
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
],
"tags": [
{
"changePct": 123,
"key": "<string>",
"previous": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
},
"value": "<string>"
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
],
"totals": {
"attributed_cost_monthly": 123,
"req_bytes": 123,
"resp_bytes": 123
}
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}