
:guide-id: metrics-for-troubleshooting-http
:guide-title: HTTP metrics
:guide-summary: Use metrics to monitor the {project_name} HTTP requests processing.
:guide-priority: 999
:guide-tile-visible: false
:version: 26.3.4

include::../attributes.adoc[]

[[metrics-for-troubleshooting-http]]
= HTTP metrics

ifeval::["" == "true"]
WARNING: This {section} is describing a feature which is currently in preview.
ifeval::["" == ""]
Please provide your feedback while we’re continuing to work on this.
endif::[]
ifeval::["" != ""]
Please provide your feedback by link:[joining this discussion] while we’re continuing to work on this.
endif::[]
endif::[]



This is part of the link:{links_observability_metrics-for-troubleshooting_url}[{links_observability_metrics-for-troubleshooting_name}] {section}.

== Prerequisites

* Metrics need to be enabled for {project_name}. Follow the link:{links_observability_configuration-metrics_url}[{links_observability_configuration-metrics_name}] {section} for more details.
* A monitoring system collecting the metrics.

== Metrics

=== Processing time

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

TIP: 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

m| http_server_requests_seconds_count
| The total number of requests processed.

m| 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`.

include::partials/histogram_note_http.adoc[]

=== Active requests

The current number of active requests is also available.

|===
|Metric |Description

m| http_server_active_requests
| The current number of active requests

|===

=== Bandwidth

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

|===
|Metric |Description

m| http_server_bytes_written_count
| The total number of responses sent.

m| http_server_bytes_written_sum
| The total number of bytes sent.

m| http_server_bytes_read_count
| The total number of requests received.

m| http_server_bytes_read_sum
| The total number of bytes received.

|===

include::partials/histogram_note_http.adoc[]


== Next steps

Return back to the link:{links_observability_metrics-for-troubleshooting_url}[{links_observability_metrics-for-troubleshooting_name}] or,

* For single site deployments proceed to link:{links_observability_metrics-for-troubleshooting-clustering-and-network_url}[{links_observability_metrics-for-troubleshooting-clustering-and-network_name}],
* and for multiple sites deployments proceed to link:{links_observability_metrics-for-troubleshooting-embedded-caches-multi-site_url}[{links_observability_metrics-for-troubleshooting-embedded-caches-multi-site_name}]


== Relevant options

[cols="12a,4",role="options"]
|===
| |Value

|
[.options-key]#`+http-metrics-histograms-enabled+`# 

[.options-description]#Enables a histogram with default buckets for the duration of HTTP server requests.#

[role="options-extended"]
--


*CLI:* `+--http-metrics-histograms-enabled+` +
*Env:* `+KC_HTTP_METRICS_HISTOGRAMS_ENABLED+`
--

Available only when metrics are enabled


|
`+true+`, `+false+` (default)

|
[.options-key]#`+http-metrics-slos+`# 

[.options-description]#Service level objectives for HTTP server requests.#

[role="options-extended"]
--
[.options-description-extended]#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


|


|===
