Obtener métricas de salud del servidor
curl --request GET \
--url http://localhost:3000/app/metrics \
--header 'Authorization: Basic <encoded-value>'import requests
url = "http://localhost:3000/app/metrics"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('http://localhost:3000/app/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_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/app/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: Basic <encoded-value>"
],
]);
$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 := "http://localhost:3000/app/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/app/metrics")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/app/metrics")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"code": "SUCCESS",
"message": "Fetch app metrics success",
"results": {
"version": "v9.6.0",
"session_store": "sqlite",
"devices": {
"total": 5,
"logged_in": 3,
"connected": 3
},
"system": {
"started_at": "2023-11-07T05:31:56Z",
"uptime_seconds": 3600,
"go_version": "go1.26.9",
"cpu_seconds": 17.9,
"memory": {
"heap_alloc_bytes": 123,
"runtime_sys_bytes": 123,
"process_rss_bytes": 123,
"container_bytes": 123,
"container_limit_bytes": 123,
"goroutines": 123,
"gc_cycles": 123
},
"folders": {},
"filesystem": {
"total_bytes": 123,
"free_bytes": 123
}
}
}
}app
Obtener métricas de salud del servidor
Memoria del proceso y de su contenedor (cgroup v2, luego v1), tiempo de la CPU, tamaño de estáticos/medios y almacenamientos (caminar en caché por un minuto), espacio libre en el volumen, la tienda de sesiones y cuántos dispositivos están registrados, conectados y conectados. No requiere ningún dispositivo. Los campos nulables son desconocidos en la plataforma actual (no Linux) o ilimitada (límite de memoria de contenedor). El mejor esfuerzo es el uso de carpetas: las entradas faltantes o ilegibles son omitidas y los objetivos de enlaces simbólicos no son recorridos. Las métricas de los contenedores usan el montaje estándar /sys/fs/cgroup y son nulas cuando no están disponibles. Uptime incluye la inicialización del proceso.
GET
/
app
/
metrics
Obtener métricas de salud del servidor
curl --request GET \
--url http://localhost:3000/app/metrics \
--header 'Authorization: Basic <encoded-value>'import requests
url = "http://localhost:3000/app/metrics"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('http://localhost:3000/app/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_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/app/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: Basic <encoded-value>"
],
]);
$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 := "http://localhost:3000/app/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/app/metrics")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/app/metrics")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"code": "SUCCESS",
"message": "Fetch app metrics success",
"results": {
"version": "v9.6.0",
"session_store": "sqlite",
"devices": {
"total": 5,
"logged_in": 3,
"connected": 3
},
"system": {
"started_at": "2023-11-07T05:31:56Z",
"uptime_seconds": 3600,
"go_version": "go1.26.9",
"cpu_seconds": 17.9,
"memory": {
"heap_alloc_bytes": 123,
"runtime_sys_bytes": 123,
"process_rss_bytes": 123,
"container_bytes": 123,
"container_limit_bytes": 123,
"goroutines": 123,
"gc_cycles": 123
},
"folders": {},
"filesystem": {
"total_bytes": 123,
"free_bytes": 123
}
}
}
}