Query Database
curl --request POST \
--url https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"names": [],
"from": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"stepSeconds": 123,
"groupBy": []
}
'import requests
url = "https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query"
payload = {
"names": [],
"from": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"stepSeconds": 123,
"groupBy": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
names: [],
from: '2023-11-07T05:31:56Z',
until: '2023-11-07T05:31:56Z',
stepSeconds: 123,
groupBy: []
})
};
fetch('https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query', 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.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query",
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([
'names' => [
],
'from' => '2023-11-07T05:31:56Z',
'until' => '2023-11-07T05:31:56Z',
'stepSeconds' => 123,
'groupBy' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query"
payload := strings.NewReader("{\n \"names\": [],\n \"from\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\",\n \"stepSeconds\": 123,\n \"groupBy\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"names\": [],\n \"from\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\",\n \"stepSeconds\": 123,\n \"groupBy\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"names\": [],\n \"from\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\",\n \"stepSeconds\": 123,\n \"groupBy\": []\n}"
response = http.request(request)
puts response.read_body{
"from": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"stepSeconds": 123,
"series": [
{
"name": "cpu.percent",
"unit": "<string>",
"labels": {},
"points": [
{
"timestamp": "2023-11-07T05:31:56Z",
"value": 123
}
]
}
]
}metrics
Query Database
Query bounded database compute, storage, connection, pool, and query-throughput series.
POST
/
v1
/
orgs
/
{orgId}
/
projects
/
{projectId}
/
databases
/
{databaseId}
/
metrics
/
query
Query Database
curl --request POST \
--url https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"names": [],
"from": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"stepSeconds": 123,
"groupBy": []
}
'import requests
url = "https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query"
payload = {
"names": [],
"from": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"stepSeconds": 123,
"groupBy": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
names: [],
from: '2023-11-07T05:31:56Z',
until: '2023-11-07T05:31:56Z',
stepSeconds: 123,
groupBy: []
})
};
fetch('https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query', 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.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query",
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([
'names' => [
],
'from' => '2023-11-07T05:31:56Z',
'until' => '2023-11-07T05:31:56Z',
'stepSeconds' => 123,
'groupBy' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query"
payload := strings.NewReader("{\n \"names\": [],\n \"from\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\",\n \"stepSeconds\": 123,\n \"groupBy\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"names\": [],\n \"from\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\",\n \"stepSeconds\": 123,\n \"groupBy\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.korve.dev/v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/metrics/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"names\": [],\n \"from\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\",\n \"stepSeconds\": 123,\n \"groupBy\": []\n}"
response = http.request(request)
puts response.read_body{
"from": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"stepSeconds": 123,
"series": [
{
"name": "cpu.percent",
"unit": "<string>",
"labels": {},
"points": [
{
"timestamp": "2023-11-07T05:31:56Z",
"value": 123
}
]
}
]
}Authorizations
apiKeysession
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The organization's id (UUID) or slug — either form is accepted.
The project's id (UUID) or slug — either form is accepted.
Body
application/json
One to 10 metric names.
Required array length:
1 - 10 elementsAvailable options:
cpu.percent, memory.used_bytes, memory.limit_bytes, disk.used_bytes, disk.limit_bytes, disk.read_iops, disk.write_iops, network.receive_bytes, network.transmit_bytes, runtime.restarts, runtime.uptime_seconds, http.requests, http.errors, database.connections, database.pool_waiting, database.queries_per_second, database.query_latency_avg_ms, database.query_latency_p50_ms, database.query_latency_p90_ms, database.query_latency_p95_ms, database.query_latency_p99_ms, queue.backlog_messages, queue.oldest_message_age_seconds, cron.failures Bucket width. Raw one-minute data is retained for 30 days; hourly aggregates for 13 months.
Available options:
avg, min, max, sum, p50, p95, p99 Available options:
instance, process, route, status, queue, cron