Commit ae9d9cd897f for php

commit ae9d9cd897f5139103fe4a362037c09c15209e65
Author: Marcel Hernandez <1ma@users.noreply.github.com>
Date:   Fri Sep 25 09:44:29 2026 +0200

    fpm: Use recommended order for OpenMetrics stat metadata (#23871)

diff --git a/NEWS b/NEWS
index 2aaa3c4c387..b0f12074446 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? ????, PHP 8.7.0alpha1

+- FPM:
+  . Use recommended TYPE, HELP order for OpenMetrics metadata.
+    (Marcel Hernandez)
+
 - Intl:
   . Fixed Collator attribute and strength methods not rejecting an
     unconstructed Collator. (Ilia Alshanetsky)
diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index ff6ef68f394..4e92198b757 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -380,44 +380,44 @@ int fpm_status_handle_request(void) /* {{{ */
 			time_format = "%s";

 			short_syntax =
-				"# HELP phpfpm_up Could pool %s using a %s PM on PHP-FPM be reached?\n"
 				"# TYPE phpfpm_up gauge\n"
+				"# HELP phpfpm_up Could pool %s using a %s PM on PHP-FPM be reached?\n"
 				"phpfpm_up 1\n"
-				"# HELP phpfpm_start_since The number of seconds since FPM has started.\n"
 				"# TYPE phpfpm_start_since counter\n"
+				"# HELP phpfpm_start_since The number of seconds since FPM has started.\n"
 				"phpfpm_start_since %lu\n"
-				"# HELP phpfpm_accepted_connections The number of requests accepted by the pool.\n"
 				"# TYPE phpfpm_accepted_connections counter\n"
+				"# HELP phpfpm_accepted_connections The number of requests accepted by the pool.\n"
 				"phpfpm_accepted_connections %lu\n"
-				"# HELP phpfpm_listen_queue The number of requests in the queue of pending connections.\n"
 				"# TYPE phpfpm_listen_queue gauge\n"
+				"# HELP phpfpm_listen_queue The number of requests in the queue of pending connections.\n"
 				"phpfpm_listen_queue %d\n"
-				"# HELP phpfpm_max_listen_queue The maximum number of requests in the queue of pending connections since FPM has started.\n"
 				"# TYPE phpfpm_max_listen_queue counter\n"
+				"# HELP phpfpm_max_listen_queue The maximum number of requests in the queue of pending connections since FPM has started.\n"
 				"phpfpm_max_listen_queue %d\n"
 				"# TYPE phpfpm_listen_queue_length gauge\n"
 				"# HELP phpfpm_listen_queue_length The size of the socket queue of pending connections.\n"
 				"phpfpm_listen_queue_length %u\n"
-				"# HELP phpfpm_idle_processes The number of idle processes.\n"
 				"# TYPE phpfpm_idle_processes gauge\n"
+				"# HELP phpfpm_idle_processes The number of idle processes.\n"
 				"phpfpm_idle_processes %d\n"
-				"# HELP phpfpm_active_processes The number of active processes.\n"
 				"# TYPE phpfpm_active_processes gauge\n"
+				"# HELP phpfpm_active_processes The number of active processes.\n"
 				"phpfpm_active_processes %d\n"
-				"# HELP phpfpm_total_processes The number of idle + active processes.\n"
 				"# TYPE phpfpm_total_processes gauge\n"
+				"# HELP phpfpm_total_processes The number of idle + active processes.\n"
 				"phpfpm_total_processes %d\n"
-				"# HELP phpfpm_max_active_processes The maximum number of active processes since FPM has started.\n"
 				"# TYPE phpfpm_max_active_processes counter\n"
+				"# HELP phpfpm_max_active_processes The maximum number of active processes since FPM has started.\n"
 				"phpfpm_max_active_processes %d\n"
-				"# HELP phpfpm_max_children_reached The number of times, the process limit has been reached, when pm tries to start more children (works only for pm 'dynamic' and 'ondemand').\n"
 				"# TYPE phpfpm_max_children_reached counter\n"
+				"# HELP phpfpm_max_children_reached The number of times, the process limit has been reached, when pm tries to start more children (works only for pm 'dynamic' and 'ondemand').\n"
 				"phpfpm_max_children_reached %u\n"
-				"# HELP phpfpm_slow_requests The number of requests that exceeded your 'request_slowlog_timeout' value.\n"
 				"# TYPE phpfpm_slow_requests counter\n"
+				"# HELP phpfpm_slow_requests The number of requests that exceeded your 'request_slowlog_timeout' value.\n"
 				"phpfpm_slow_requests %lu\n"
-				"# HELP phpfpm_memory_peak The memory usage peak since FPM has started.\n"
 				"# TYPE phpfpm_memory_peak gauge\n"
+				"# HELP phpfpm_memory_peak The memory usage peak since FPM has started.\n"
 				"phpfpm_memory_peak %zu\n"
 				"# EOF\n";

diff --git a/sapi/fpm/tests/status.inc b/sapi/fpm/tests/status.inc
index 76ef7fd55e1..c5858d3f68a 100644
--- a/sapi/fpm/tests/status.inc
+++ b/sapi/fpm/tests/status.inc
@@ -231,44 +231,44 @@ class Status
      */
     protected function checkStatusOpenmetrics(string $body, array $fields)
     {
-        $pattern = "(# HELP phpfpm_up Could pool " . $fields['pool'] . " using a " . $fields['process manager'] . " PM on PHP-FPM be reached\?\n" .
-            "# TYPE phpfpm_up gauge\n" .
+        $pattern = "(# TYPE phpfpm_up gauge\n" .
+            "# HELP phpfpm_up Could pool " . $fields['pool'] . " using a " . $fields['process manager'] . " PM on PHP-FPM be reached\?\n" .
             "phpfpm_up 1\n" .
-            "# HELP phpfpm_start_since The number of seconds since FPM has started\.\n" .
             "# TYPE phpfpm_start_since counter\n" .
+            "# HELP phpfpm_start_since The number of seconds since FPM has started\.\n" .
             "phpfpm_start_since " . $fields['start since'] . "\n" .
-            "# HELP phpfpm_accepted_connections The number of requests accepted by the pool\.\n" .
             "# TYPE phpfpm_accepted_connections counter\n" .
+            "# HELP phpfpm_accepted_connections The number of requests accepted by the pool\.\n" .
             "phpfpm_accepted_connections " . $fields['accepted conn'] . "\n" .
-            "# HELP phpfpm_listen_queue The number of requests in the queue of pending connections\.\n" .
             "# TYPE phpfpm_listen_queue gauge\n" .
+            "# HELP phpfpm_listen_queue The number of requests in the queue of pending connections\.\n" .
             "phpfpm_listen_queue " . $fields['listen queue'] . "\n" .
-            "# HELP phpfpm_max_listen_queue The maximum number of requests in the queue of pending connections since FPM has started\.\n" .
             "# TYPE phpfpm_max_listen_queue counter\n" .
+            "# HELP phpfpm_max_listen_queue The maximum number of requests in the queue of pending connections since FPM has started\.\n" .
             "phpfpm_max_listen_queue " . $fields['max listen queue'] . "\n" .
             "# TYPE phpfpm_listen_queue_length gauge\n" .
             "# HELP phpfpm_listen_queue_length The size of the socket queue of pending connections\.\n" .
             "phpfpm_listen_queue_length " . $fields['listen queue len'] . "\n" .
-            "# HELP phpfpm_idle_processes The number of idle processes\.\n" .
             "# TYPE phpfpm_idle_processes gauge\n" .
+            "# HELP phpfpm_idle_processes The number of idle processes\.\n" .
             "phpfpm_idle_processes " . $fields['idle processes'] . "\n" .
-            "# HELP phpfpm_active_processes The number of active processes\.\n" .
             "# TYPE phpfpm_active_processes gauge\n" .
+            "# HELP phpfpm_active_processes The number of active processes\.\n" .
             "phpfpm_active_processes " . $fields['active processes'] . "\n" .
-            "# HELP phpfpm_total_processes The number of idle \+ active processes\.\n" .
             "# TYPE phpfpm_total_processes gauge\n" .
+            "# HELP phpfpm_total_processes The number of idle \+ active processes\.\n" .
             "phpfpm_total_processes " . $fields['total processes'] . "\n" .
-            "# HELP phpfpm_max_active_processes The maximum number of active processes since FPM has started\.\n" .
             "# TYPE phpfpm_max_active_processes counter\n" .
+            "# HELP phpfpm_max_active_processes The maximum number of active processes since FPM has started\.\n" .
             "phpfpm_max_active_processes " . $fields['max active processes'] . "\n" .
-            "# HELP phpfpm_max_children_reached The number of times, the process limit has been reached, when pm tries to start more children \(works only for pm 'dynamic' and 'ondemand'\)\.\n" .
             "# TYPE phpfpm_max_children_reached counter\n" .
+            "# HELP phpfpm_max_children_reached The number of times, the process limit has been reached, when pm tries to start more children \(works only for pm 'dynamic' and 'ondemand'\)\.\n" .
             "phpfpm_max_children_reached " . $fields['max children reached'] . "\n" .
-            "# HELP phpfpm_slow_requests The number of requests that exceeded your 'request_slowlog_timeout' value\.\n" .
             "# TYPE phpfpm_slow_requests counter\n" .
+            "# HELP phpfpm_slow_requests The number of requests that exceeded your 'request_slowlog_timeout' value\.\n" .
             "phpfpm_slow_requests " . $fields['slow requests'] . "\n" .
-            "# HELP phpfpm_memory_peak The memory usage peak since FPM has started\.\n" .
             "# TYPE phpfpm_memory_peak gauge\n" .
+            "# HELP phpfpm_memory_peak The memory usage peak since FPM has started\.\n" .
             "phpfpm_memory_peak " . $fields['memory peak'] . "\n" .
             "# EOF)\n";