curl --request GET \
--url {schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service} \
--header 'Authorization: Bearer <token>'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}', 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 => "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}",
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: Bearer <token>"
],
]);
$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 := "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_grain": 5,
"_from": 1704067200,
"_to": 1704153600,
"_project_id": "abc123def456",
"_environment_id": "main",
"_branch_machine_name": "main-bvxea6i",
"_service": "admin-pipeline--kafka-profile-payloads",
"data": [
{
"timestamp": 1764083040,
"instances": {}
}
],
"_dg2_host_types_mapping": {
"app.0": "web",
"app.1": "unified",
"worker.0": ""
}
}{
"type": "https://tools.ietf.org/html/rfc2616#section-1",
"title": "Please ensure parameters are correct.",
"status": 400,
"violations": {
"grain": [
"Grain can not be larger than the selection windows."
],
"from": [
"The from timestamp must be in the past."
],
"to": [
"The to timestamp must be greater than the from timestamp."
]
}
}{
"error": "Too much data fetched",
"message": "Please reduce the time range or add more filters to narrow down the query"
}Get resource metrics by service
Returns time-series resource data for one service. Each timestamp contains per-instance metrics. Filter results using aggs[] (min, max, avg, stddev, p50, p95-p99) and types[] (cpu, memory, swap, disk, inodes, pressure metrics). Response grouped by timestamp then instance ID (e.g., “app.0”). All aggregations nullable when insufficient data exists.
curl --request GET \
--url {schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service} \
--header 'Authorization: Bearer <token>'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}', 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 => "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}",
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: Bearer <token>"
],
]);
$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 := "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_grain": 5,
"_from": 1704067200,
"_to": 1704153600,
"_project_id": "abc123def456",
"_environment_id": "main",
"_branch_machine_name": "main-bvxea6i",
"_service": "admin-pipeline--kafka-profile-payloads",
"data": [
{
"timestamp": 1764083040,
"instances": {}
}
],
"_dg2_host_types_mapping": {
"app.0": "web",
"app.1": "unified",
"worker.0": ""
}
}{
"type": "https://tools.ietf.org/html/rfc2616#section-1",
"title": "Please ensure parameters are correct.",
"status": 400,
"violations": {
"grain": [
"Grain can not be larger than the selection windows."
],
"from": [
"The from timestamp must be in the past."
],
"to": [
"The to timestamp must be greater than the from timestamp."
]
}
}{
"error": "Too much data fetched",
"message": "Please reduce the time range or add more filters to narrow down the query"
}Authorizations
Path Parameters
Query Parameters
Statistical aggregations to include in the response. Can be specified multiple times. Available values: avg, stddev, max, min, p50, p95, p96, p97, p98, p99. Specify parameter multiple times for multiple values (e.g., ?aggs[]=avg&aggs[]=p50).
avg, stddev, max, min, p50, p95, p96, p97, p98, p99 Metric types to include in the response. Can be specified multiple times. Available values: cpu, memory, disk, inodes, swap, memory_pressure, cpu_pressure, io_pressure, irq_pressure. Specify parameter multiple times for multiple values (e.g., ?types[]=cpu&types[]=memory).
cpu, memory, disk, inodes, swap, memory_pressure, cpu_pressure, io_pressure, irq_pressure Response
Successfully retrieved service-specific resource metrics with time-series data
Was this page helpful?