Query a batch of native PlanetScale module metrics
curl --request POST \
--url https://api.ravion.com/metrics/planetscale/query-range \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_time": "2023-11-07T05:31:56Z",
"metrics": [
{
"id": "<string>"
}
],
"moduleInstanceId": "<string>",
"period_seconds": 43200,
"start_time": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.ravion.com/metrics/planetscale/query-range"
payload = {
"end_time": "2023-11-07T05:31:56Z",
"metrics": [{ "id": "<string>" }],
"moduleInstanceId": "<string>",
"period_seconds": 43200,
"start_time": "2023-11-07T05:31:56Z"
}
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({
end_time: '2023-11-07T05:31:56Z',
metrics: [{id: '<string>'}],
moduleInstanceId: '<string>',
period_seconds: 43200,
start_time: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.ravion.com/metrics/planetscale/query-range', 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.ravion.com/metrics/planetscale/query-range",
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([
'end_time' => '2023-11-07T05:31:56Z',
'metrics' => [
[
'id' => '<string>'
]
],
'moduleInstanceId' => '<string>',
'period_seconds' => 43200,
'start_time' => '2023-11-07T05:31:56Z'
]),
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.ravion.com/metrics/planetscale/query-range"
payload := strings.NewReader("{\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"metrics\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"moduleInstanceId\": \"<string>\",\n \"period_seconds\": 43200,\n \"start_time\": \"2023-11-07T05:31:56Z\"\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.ravion.com/metrics/planetscale/query-range")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"metrics\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"moduleInstanceId\": \"<string>\",\n \"period_seconds\": 43200,\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ravion.com/metrics/planetscale/query-range")
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 \"end_time\": \"2023-11-07T05:31:56Z\",\n \"metrics\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"moduleInstanceId\": \"<string>\",\n \"period_seconds\": 43200,\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"metrics": [
{
"id": "<string>",
"data": {
"name": "avg_parallel_workers",
"series": [
{
"datapoints": [
{
"timestamp": "2023-11-07T05:31:56Z",
"value": 123
}
],
"label": "<string>",
"labels": {},
"name": "<string>"
}
],
"step_seconds": 123,
"unit": "<string>",
"unavailable": "<string>"
},
"unavailable": "<string>"
}
]
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}API Reference
Query a batch of native PlanetScale module metrics
Query native PlanetScale metrics declared on an authorized module. Credentials remain inside the broker; native database targets are resolved server-side.
POST
/
metrics
/
planetscale
/
query-range
Query a batch of native PlanetScale module metrics
curl --request POST \
--url https://api.ravion.com/metrics/planetscale/query-range \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_time": "2023-11-07T05:31:56Z",
"metrics": [
{
"id": "<string>"
}
],
"moduleInstanceId": "<string>",
"period_seconds": 43200,
"start_time": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.ravion.com/metrics/planetscale/query-range"
payload = {
"end_time": "2023-11-07T05:31:56Z",
"metrics": [{ "id": "<string>" }],
"moduleInstanceId": "<string>",
"period_seconds": 43200,
"start_time": "2023-11-07T05:31:56Z"
}
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({
end_time: '2023-11-07T05:31:56Z',
metrics: [{id: '<string>'}],
moduleInstanceId: '<string>',
period_seconds: 43200,
start_time: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.ravion.com/metrics/planetscale/query-range', 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.ravion.com/metrics/planetscale/query-range",
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([
'end_time' => '2023-11-07T05:31:56Z',
'metrics' => [
[
'id' => '<string>'
]
],
'moduleInstanceId' => '<string>',
'period_seconds' => 43200,
'start_time' => '2023-11-07T05:31:56Z'
]),
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.ravion.com/metrics/planetscale/query-range"
payload := strings.NewReader("{\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"metrics\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"moduleInstanceId\": \"<string>\",\n \"period_seconds\": 43200,\n \"start_time\": \"2023-11-07T05:31:56Z\"\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.ravion.com/metrics/planetscale/query-range")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"metrics\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"moduleInstanceId\": \"<string>\",\n \"period_seconds\": 43200,\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ravion.com/metrics/planetscale/query-range")
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 \"end_time\": \"2023-11-07T05:31:56Z\",\n \"metrics\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"moduleInstanceId\": \"<string>\",\n \"period_seconds\": 43200,\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"metrics": [
{
"id": "<string>",
"data": {
"name": "avg_parallel_workers",
"series": [
{
"datapoints": [
{
"timestamp": "2023-11-07T05:31:56Z",
"value": 123
}
],
"label": "<string>",
"labels": {},
"name": "<string>"
}
],
"step_seconds": 123,
"unit": "<string>",
"unavailable": "<string>"
},
"unavailable": "<string>"
}
]
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}Body
application/json
Response
The request has succeeded.
Show child attributes
Show child attributes
Was this page helpful?