@@ -140,7 +140,7 @@ int fpm_status_handle_request(void) /* {{{ */
140
140
struct fpm_scoreboard_proc_s proc ;
141
141
char * buffer , * time_format , time_buffer [64 ];
142
142
time_t now_epoch ;
143
- int full , encode ;
143
+ int full , encode , is_start_time_str ;
144
144
char * short_syntax , * short_post ;
145
145
char * full_pre , * full_syntax , * full_post , * full_separator ;
146
146
zend_string * _GET_str ;
@@ -223,6 +223,7 @@ int fpm_status_handle_request(void) /* {{{ */
223
223
short_syntax = short_post = NULL ;
224
224
full_separator = full_pre = full_syntax = full_post = NULL ;
225
225
encode = 0 ;
226
+ is_start_time_str = 1 ;
226
227
227
228
/* HTML */
228
229
if (fpm_php_get_string_from_table (_GET_str , "html" )) {
@@ -399,7 +400,7 @@ int fpm_status_handle_request(void) /* {{{ */
399
400
"phpfpm_up 1\n"
400
401
"# HELP phpfpm_start_time When FPM has started.\n"
401
402
"# TYPE phpfpm_start_time gauge\n"
402
- "phpfpm_start_time %lu \n"
403
+ "phpfpm_start_time %lld \n"
403
404
"# HELP phpfpm_start_since_total The number of seconds since FPM has started.\n"
404
405
"# TYPE phpfpm_start_since_total counter\n"
405
406
"phpfpm_start_since_total %lu\n"
@@ -408,7 +409,7 @@ int fpm_status_handle_request(void) /* {{{ */
408
409
"phpfpm_accepted_connections_total %lu\n"
409
410
"# HELP phpfpm_listen_queue The number of requests in the queue of pending connections.\n"
410
411
"# TYPE phpfpm_listen_queue gauge\n"
411
- "phpfpm_listen_queue %lu \n"
412
+ "phpfpm_listen_queue %d \n"
412
413
"# HELP phpfpm_max_listen_queue_total The maximum number of requests in the queue of pending connections since FPM has started.\n"
413
414
"# TYPE phpfpm_max_listen_queue_total counter\n"
414
415
"phpfpm_max_listen_queue_total %d\n"
@@ -434,6 +435,7 @@ int fpm_status_handle_request(void) /* {{{ */
434
435
"# TYPE phpfpm_slow_requests_total counter\n"
435
436
"phpfpm_slow_requests_total %lu\n" ;
436
437
438
+ is_start_time_str = 0 ;
437
439
if (!full ) {
438
440
short_post = "" ;
439
441
} else {
@@ -484,23 +486,41 @@ int fpm_status_handle_request(void) /* {{{ */
484
486
}
485
487
}
486
488
487
- strftime (time_buffer , sizeof (time_buffer ) - 1 , time_format , localtime (& scoreboard .start_epoch ));
488
489
now_epoch = time (NULL );
489
- spprintf (& buffer , 0 , short_syntax ,
490
- scoreboard .pool ,
491
- PM2STR (scoreboard .pm ),
492
- time_buffer ,
493
- (unsigned long ) (now_epoch - scoreboard .start_epoch ),
494
- scoreboard .requests ,
495
- scoreboard .lq ,
496
- scoreboard .lq_max ,
497
- scoreboard .lq_len ,
498
- scoreboard .idle ,
499
- scoreboard .active ,
500
- scoreboard .idle + scoreboard .active ,
501
- scoreboard .active_max ,
502
- scoreboard .max_children_reached ,
503
- scoreboard .slow_rq );
490
+ if (is_start_time_str ) {
491
+ strftime (time_buffer , sizeof (time_buffer ) - 1 , time_format , localtime (& scoreboard .start_epoch ));
492
+ spprintf (& buffer , 0 , short_syntax ,
493
+ scoreboard .pool ,
494
+ PM2STR (scoreboard .pm ),
495
+ time_buffer ,
496
+ (unsigned long ) (now_epoch - scoreboard .start_epoch ),
497
+ scoreboard .requests ,
498
+ scoreboard .lq ,
499
+ scoreboard .lq_max ,
500
+ scoreboard .lq_len ,
501
+ scoreboard .idle ,
502
+ scoreboard .active ,
503
+ scoreboard .idle + scoreboard .active ,
504
+ scoreboard .active_max ,
505
+ scoreboard .max_children_reached ,
506
+ scoreboard .slow_rq );
507
+ } else {
508
+ spprintf (& buffer , 0 , short_syntax ,
509
+ scoreboard .pool ,
510
+ PM2STR (scoreboard .pm ),
511
+ scoreboard .start_epoch ,
512
+ (unsigned long ) (now_epoch - scoreboard .start_epoch ),
513
+ scoreboard .requests ,
514
+ scoreboard .lq ,
515
+ scoreboard .lq_max ,
516
+ scoreboard .lq_len ,
517
+ scoreboard .idle ,
518
+ scoreboard .active ,
519
+ scoreboard .idle + scoreboard .active ,
520
+ scoreboard .active_max ,
521
+ scoreboard .max_children_reached ,
522
+ scoreboard .slow_rq );
523
+ }
504
524
505
525
PUTS (buffer );
506
526
efree (buffer );
0 commit comments