HTTP metrics

Learn about metrics for monitoring the Keycloak HTTP requests processing

This is part of the Troubleshooting using metrics guide.

Prerequisites

  • Metrics need to be enabled for Keycloak. Follow the Gaining insights with metrics guide for more details.

  • A monitoring system collecting the metrics.

Metrics

Processing time

The processing time is exposed by these metrics, to monitor the Keycloak performance and how long it takes to processing the requests.

On a healthy cluster, the average processing time will remain stable. Spikes or increases in the processing time may be an early sign that some node is under load.

Tags

method

HTTP method.

outcome

A more general outcome tag.

status

The HTTP status code.

uri

The requested URI.

Metric Description

http_server_requests_seconds_count

The total number of requests processed.

http_server_requests_seconds_sum

The total duration for all the requests processed.

You can enable histograms for this metric by setting http-metrics-histograms-enabled to true, and add additional buckets for service level objectives using the option http-metrics-slos.

When histograms are enabled, the percentile buckets are available. Those are useful to create heat maps and analyze latencies, still collecting and exposing the percentile buckets will increase the load of to your monitoring system.

Active requests

The current number of active requests is also available.

Metric Description

http_server_active_requests

The current number of active requests

Bandwidth

The metrics below helps to monitor the bandwidth and consumed traffic used by Keycloak and consumed by the requests and responses received or sent.

Metric Description

http_server_bytes_written_count

The total number of responses sent.

http_server_bytes_written_sum

The total number of bytes sent.

http_server_bytes_read_count

The total number of requests received.

http_server_bytes_read_sum

The total number of bytes received.

When histograms are enabled, the percentile buckets are available. Those are useful to create heat maps and analyze latencies, still collecting and exposing the percentile buckets will increase the load of to your monitoring system.

Next steps

Return back to the Troubleshooting using metrics or,

Relevant options

Value

http-metrics-histograms-enabled

Enables a histogram with default buckets for the duration of HTTP server requests.

CLI: --http-metrics-histograms-enabled
Env: KC_HTTP_METRICS_HISTOGRAMS_ENABLED

Available only when metrics are enabled

true, false (default)

http-metrics-slos

Service level objectives for HTTP server requests.

Use this instead of the default histogram, or use it in combination to add additional buckets. Specify a list of comma-separated values defined in milliseconds. Example with buckets from 5ms to 10s: 5,10,25,50,250,500,1000,2500,5000,10000

CLI: --http-metrics-slos
Env: KC_HTTP_METRICS_SLOS

Available only when metrics are enabled

On this page