Enabling Keycloak Metrics - Keycloak
Enabling Keycloak Metrics - Keycloak
Enabling Keycloak Metrics - Keycloak
Keycloak has built in support for metrics. This guide describes how to enable and configure server
metrics.
Enabling Metrics
It is possible to enable metrics using the build time option metrics-enabled :
Querying Metrics
Keycloak exposes metrics at the following endpoint:
/metrics
The response from the endpoint uses a text/plain content type and it is based on the
Prometheus text format. The snippet bellow is an example of a response:
# HELP base_gc_total Displays the total number of collections that have occurred. This a
# TYPE base_gc_total counter
base_gc_total{name="G1 Young Generation",} 14.0
# HELP jvm_memory_usage_after_gc_percent The percentage of long-lived heap pool used aft
# TYPE jvm_memory_usage_after_gc_percent gauge
jvm_memory_usage_after_gc_percent{area="heap",pool="long-lived",} 0.0
# HELP jvm_threads_peak_threads The peak live thread count since the Java virtual machin
# TYPE jvm_threads_peak_threads gauge
jvm_threads_peak_threads 113.0
# HELP agroal_active_count Number of active connections. These connections are in use an
# TYPE agroal_active_count gauge
agroal_active_count{datasource="default",} 0.0
# HELP base_memory_maxHeap_bytes Displays the maximum amount of memory, in bytes, that c
# TYPE base_memory_maxHeap_bytes gauge
https://www.keycloak.org/server/configuration-metrics 1/3
30/03/2023, 11:04 Enabling Keycloak Metrics - Keycloak
base_memory_maxHeap_bytes 1.6781410304E10
# HELP process_start_time_seconds Start time of the process since unix epoch.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.675188449054E9
# HELP system_load_average_1m The sum of the number of runnable entities queued to avail
# TYPE system_load_average_1m gauge
system_load_average_1m 4.005859375
...
Available Metrics
The table below summarizes the available metrics groups:
Metric Description
Relevant options
Value
https://www.keycloak.org/server/configuration-metrics 2/3
30/03/2023, 11:04 Enabling Keycloak Metrics - Keycloak
On this page
Enabling Metrics
Querying Metrics
Available Metrics
Relevant options
Sponsored by
https://www.keycloak.org/server/configuration-metrics 3/3