Prometheus Metrics
Prometheus is an open-source toolkit for system monitoring and alerting. The system collects information about the health of servers and applications and can send alerts when issues arise.
The monitored components are referred to as targets. A key distinction from other monitoring systems is its data collection method: Prometheus actively scrapes required data from servers and devices by querying targets using the PromQL language.
Metrics are stored as time series, where each metric is recorded with a timestamp and accompanied by additional key-value pairs known as labels.
Metrics are available via the /metrics endpoint, with the api_key={api_key_value} parameter included. The API key must have the Prometheus Metrics privilege with Read permission. A complete URL might look like this:
https://test.operavix.com/metrics?api_key=4952343e6e1448a69518f7b2523e340d
Only Java Virtual Machine (JVM) metrics are collected.
Example Metrics
Below are examples of metrics collected by the system.
jvm_memory_used_bytes — amount of memory currently used, in bytes:
# HELP jvm_memory_used_bytes Used bytes of a given JVM memory area.
# TYPE jvm_memory_used_bytes gauge
jvm_memory_used_bytes{area="heap"} 1.7151512E8
jvm_threads_started_total — total number of threads started in the JVM:
# HELP jvm_threads_started_total Started thread count of a JVM
# TYPE jvm_threads_started_total counter
jvm_threads_started_total 4842.0
jvm_threads_state — number of threads in a given state:
# HELP jvm_threads_state Current count of threads by state
# TYPE jvm_threads_state gauge
jvm_threads_state{state="BLOCKED"} 0.0
jvm_threads_state{state="NEW"} 0.0
jvm_threads_state{state="RUNNABLE"} 32.0
process_cpu_usage_percentage — CPU usage as a percentage (value between 0 and 100):
# HELP process_cpu_usage_percentage CPU usage in percentage. CPU load between 0 and 100.
# TYPE process_cpu_usage_percentage gauge
process_cpu_usage_percentage 4.633415099482148
node_filesystem_size_bytes — free, total, and used disk space in bytes:
# HELP node_filesystem_size_bytes Filesystem size in bytes.
# TYPE node_filesystem_size_bytes gauge
node_filesystem_size_bytes{type="Free"} 1.12989249536E11
node_filesystem_size_bytes{type="Total"} 5.11440576512E11
node_filesystem_size_bytes{type="Usage"} 3.98451326976E11
node_memory_bytes — free, total, and used RAM in bytes:
# HELP node_memory_bytes Process memory in bytes.
# TYPE node_memory_bytes gauge
node_memory_bytes{type="Free"} 1.7631875072E10
node_memory_bytes{type="Total"} 3.3142767616E10
node_memory_bytes{type="Usage"} 1.5510892544E10
http_server_requests_seconds — number of HTTP requests to the Operavix system and their execution times in seconds:
# TYPE http_server_requests_seconds histogram
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="0.005"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="0.01"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="0.025"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="0.05"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="0.1"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="0.25"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="0.5"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="1.0"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="2.5"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="5.0"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="10.0"} 2
http_server_requests_seconds_bucket{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304",le="+Inf"} 2
http_server_requests_seconds_count{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304"} 2
http_server_requests_seconds_sum{method="GET",path="/_build/static/css/main.d0c31d4330cd73f2.css",status="304"} 0.0031729999999999996
Errors During Metric Collection
| Error Code | Description |
|---|---|
auth_ambiguity | Metrics requested using an API key while logged into Operavix |
illegal_apikey_exception | API key contains fewer than 8 characters |
invalid_credentials | API key does not exist in the system |
access_denied | Insufficient privileges for the API key |
Was the article helpful?