Get environment metrics
curl --request GET \
--url https://cloud.laravel.com/api/environments/{environment}/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://cloud.laravel.com/api/environments/{environment}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://cloud.laravel.com/api/environments/{environment}/metrics', 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://cloud.laravel.com/api/environments/{environment}/metrics",
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 := "https://cloud.laravel.com/api/environments/{environment}/metrics"
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("https://cloud.laravel.com/api/environments/{environment}/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/environments/{environment}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"cpu_usage": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
},
"memory_usage": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
},
"http_response_count": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"total": 123,
"average": [
123
],
"min": 123,
"max": 123
},
"replica_count": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
},
"web_workers_count": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
}
},
"meta": {
"period": "<string>",
"available_periods": [
"<string>"
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Environments
Get environment metrics
Get metrics for a specific environment.
Each metric is read separately; one that could not be read is {"error": true} while the rest are
returned. For http_response_count, average holds each series’ sum over the period and total the
sum of all of them. min and max are bounds for charting the series.
In cpu_usage and memory_usage, a y value is null when the instance reported no sample for that
interval, for example while it restarts or sleeps. It is not zero usage. average ignores these intervals,
and is null for an instance with no sample in the period.
GET
/
environments
/
{environment}
/
metrics
Get environment metrics
curl --request GET \
--url https://cloud.laravel.com/api/environments/{environment}/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://cloud.laravel.com/api/environments/{environment}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://cloud.laravel.com/api/environments/{environment}/metrics', 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://cloud.laravel.com/api/environments/{environment}/metrics",
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 := "https://cloud.laravel.com/api/environments/{environment}/metrics"
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("https://cloud.laravel.com/api/environments/{environment}/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/environments/{environment}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"cpu_usage": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
},
"memory_usage": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
},
"http_response_count": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"total": 123,
"average": [
123
],
"min": 123,
"max": 123
},
"replica_count": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
},
"web_workers_count": {
"labels": [
"<string>"
],
"data": [
{
"x": "<string>",
"y": [
123
]
}
],
"average": [
123
],
"min": 123,
"max": 123
}
},
"meta": {
"period": "<string>",
"available_periods": [
"<string>"
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Required permission:
environment_metric.viewWas this page helpful?

