diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index 1d587711c..2b07efa96 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -79,8 +79,8 @@ struct promex_metric_filter { struct promex_ctx { void *p[4]; /* generic pointers used to save context */ unsigned int flags; /* PROMEX_FL_* */ - unsigned field_num; /* current field number (ST_F_* etc) */ - unsigned mod_field_num; /* first field number of the current module (ST_F_* etc) */ + unsigned field_num; /* current field number (ST_I_PX_* etc) */ + unsigned mod_field_num; /* first field number of the current module (ST_I_PX_* etc) */ int obj_state; /* current state among PROMEX_{FRONT|BACK|SRV|LI}_STATE_* */ struct list modules; /* list of promex modules to export */ struct eb_root filters; /* list of filters to apply on metrics name */ @@ -173,154 +173,154 @@ const struct promex_metric promex_global_metrics[INF_TOTAL_FIELDS] = { }; /* frontend/backend/server fields */ -const struct promex_metric promex_st_metrics[ST_F_TOTAL_FIELDS] = { - //[ST_F_PXNAME] ignored - //[ST_F_SVNAME] ignored - [ST_F_QCUR] = { .n = IST("current_queue"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_QMAX] = { .n = IST("max_queue"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_SCUR] = { .n = IST("current_sessions"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_SMAX] = { .n = IST("max_sessions"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_SLIM] = { .n = IST("limit_sessions"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_STOT] = { .n = IST("sessions_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_BIN] = { .n = IST("bytes_in_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_BOUT] = { .n = IST("bytes_out_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_DREQ] = { .n = IST("requests_denied_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_DRESP] = { .n = IST("responses_denied_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_EREQ] = { .n = IST("request_errors_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC ) }, - [ST_F_ECON] = { .n = IST("connection_errors_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_ERESP] = { .n = IST("response_errors_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_WRETR] = { .n = IST("retry_warnings_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_WREDIS] = { .n = IST("redispatch_warnings_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_STATUS] = { .n = IST("status"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_WEIGHT] = { .n = IST("weight"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_ACT] = { .n = IST("active_servers"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_BCK] = { .n = IST("backup_servers"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_CHKFAIL] = { .n = IST("check_failures_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_CHKDOWN] = { .n = IST("check_up_down_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_LASTCHG] = { .n = IST("check_last_change_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_DOWNTIME] = { .n = IST("downtime_seconds_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_QLIMIT] = { .n = IST("queue_limit"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - //[ST_F_PID] ignored - //[ST_F_IID] ignored - //[ST_F_SID] ignored - [ST_F_THROTTLE] = { .n = IST("current_throttle"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_LBTOT] = { .n = IST("loadbalanced_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - //[ST_F_TRACKED] ignored - //[ST_F_TYPE] ignored - //[ST_F_RATE] ignored - [ST_F_RATE_LIM] = { .n = IST("limit_session_rate"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC ) }, - [ST_F_RATE_MAX] = { .n = IST("max_session_rate"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_CHECK_STATUS] = { .n = IST("check_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_CHECK_CODE] = { .n = IST("check_code"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_CHECK_DURATION] = { .n = IST("check_duration_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_HRSP_1XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_HRSP_2XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_HRSP_3XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_HRSP_4XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_HRSP_5XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_HRSP_OTHER] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - //[ST_F_HANAFAIL] ignored - //[ST_F_REQ_RATE] ignored - [ST_F_REQ_RATE_MAX] = { .n = IST("http_requests_rate_max"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC ) }, - [ST_F_REQ_TOT] = { .n = IST("http_requests_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_CLI_ABRT] = { .n = IST("client_aborts_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_SRV_ABRT] = { .n = IST("server_aborts_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_COMP_IN] = { .n = IST("http_comp_bytes_in_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_COMP_OUT] = { .n = IST("http_comp_bytes_out_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_COMP_BYP] = { .n = IST("http_comp_bytes_bypassed_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_COMP_RSP] = { .n = IST("http_comp_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_LASTSESS] = { .n = IST("last_session_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - //[ST_F_LAST_CHK] ignored - //[ST_F_LAST_AGT] ignored - [ST_F_QTIME] = { .n = IST("queue_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_CTIME] = { .n = IST("connect_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_RTIME] = { .n = IST("response_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_TTIME] = { .n = IST("total_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - //[ST_F_AGENT_STATUS] ignored - //[ST_F_AGENT_CODE] ignored - //[ST_F_AGENT_DURATION] ignored - //[ST_F_CHECK_DESC] ignored - //[ST_F_AGENT_DESC] ignored - //[ST_F_CHECK_RISE] ignored - //[ST_F_CHECK_FALL] ignored - //[ST_F_CHECK_HEALTH] ignored - //[ST_F_AGENT_RISE] ignored - //[ST_F_AGENT_FALL] ignored - //[ST_F_AGENT_HEALTH] ignored - //[ST_F_ADDR] ignored - //[ST_F_COOKIE] ignored - //[ST_F_MODE] ignored - //[ST_F_ALGO] ignored - //[ST_F_CONN_RATE] ignored - [ST_F_CONN_RATE_MAX] = { .n = IST("connections_rate_max"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC ) }, - [ST_F_CONN_TOT] = { .n = IST("connections_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC ) }, - [ST_F_INTERCEPTED] = { .n = IST("intercepted_requests_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC ) }, - [ST_F_DCON] = { .n = IST("denied_connections_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC ) }, - [ST_F_DSES] = { .n = IST("denied_sessions_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC ) }, - [ST_F_WREW] = { .n = IST("failed_header_rewriting_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_CONNECT] = { .n = IST("connection_attempts_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_REUSE] = { .n = IST("connection_reuses_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_CACHE_LOOKUPS] = { .n = IST("http_cache_lookups_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_CACHE_HITS] = { .n = IST("http_cache_hits_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, - [ST_F_SRV_ICUR] = { .n = IST("idle_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_SRV_ILIM] = { .n = IST("idle_connections_limit"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_QT_MAX] = { .n = IST("max_queue_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_CT_MAX] = { .n = IST("max_connect_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_RT_MAX] = { .n = IST("max_response_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_TT_MAX] = { .n = IST("max_total_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_EINT] = { .n = IST("internal_errors_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_IDLE_CONN_CUR] = { .n = IST("unsafe_idle_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_SAFE_CONN_CUR] = { .n = IST("safe_idle_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_USED_CONN_CUR] = { .n = IST("used_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_NEED_CONN_EST] = { .n = IST("need_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, - [ST_F_UWEIGHT] = { .n = IST("uweight"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, - [ST_F_AGG_SRV_CHECK_STATUS] = { .n = IST("agg_server_check_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC ) }, - [ST_F_AGG_SRV_STATUS ] = { .n = IST("agg_server_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC ) }, - [ST_F_AGG_CHECK_STATUS] = { .n = IST("agg_check_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC ) }, +const struct promex_metric promex_st_metrics[ST_I_PX_MAX] = { + //[ST_I_PX_PXNAME] ignored + //[ST_I_PX_SVNAME] ignored + [ST_I_PX_QCUR] = { .n = IST("current_queue"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_QMAX] = { .n = IST("max_queue"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_SCUR] = { .n = IST("current_sessions"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_SMAX] = { .n = IST("max_sessions"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_SLIM] = { .n = IST("limit_sessions"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_STOT] = { .n = IST("sessions_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_BIN] = { .n = IST("bytes_in_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_BOUT] = { .n = IST("bytes_out_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_DREQ] = { .n = IST("requests_denied_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_DRESP] = { .n = IST("responses_denied_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_EREQ] = { .n = IST("request_errors_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC ) }, + [ST_I_PX_ECON] = { .n = IST("connection_errors_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_ERESP] = { .n = IST("response_errors_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_WRETR] = { .n = IST("retry_warnings_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_WREDIS] = { .n = IST("redispatch_warnings_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_STATUS] = { .n = IST("status"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_WEIGHT] = { .n = IST("weight"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_ACT] = { .n = IST("active_servers"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_BCK] = { .n = IST("backup_servers"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CHKFAIL] = { .n = IST("check_failures_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CHKDOWN] = { .n = IST("check_up_down_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_LASTCHG] = { .n = IST("check_last_change_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_DOWNTIME] = { .n = IST("downtime_seconds_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_QLIMIT] = { .n = IST("queue_limit"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + //[ST_I_PX_PID] ignored + //[ST_I_PX_IID] ignored + //[ST_I_PX_SID] ignored + [ST_I_PX_THROTTLE] = { .n = IST("current_throttle"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_LBTOT] = { .n = IST("loadbalanced_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + //[ST_I_PX_TRACKED] ignored + //[ST_I_PX_TYPE] ignored + //[ST_I_PX_RATE] ignored + [ST_I_PX_RATE_LIM] = { .n = IST("limit_session_rate"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC ) }, + [ST_I_PX_RATE_MAX] = { .n = IST("max_session_rate"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CHECK_STATUS] = { .n = IST("check_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CHECK_CODE] = { .n = IST("check_code"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CHECK_DURATION] = { .n = IST("check_duration_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_HRSP_1XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_HRSP_2XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_HRSP_3XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_HRSP_4XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_HRSP_5XX] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_HRSP_OTHER] = { .n = IST("http_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + //[ST_I_PX_HANAFAIL] ignored + //[ST_I_PX_REQ_RATE] ignored + [ST_I_PX_REQ_RATE_MAX] = { .n = IST("http_requests_rate_max"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC ) }, + [ST_I_PX_REQ_TOT] = { .n = IST("http_requests_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_CLI_ABRT] = { .n = IST("client_aborts_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_SRV_ABRT] = { .n = IST("server_aborts_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_COMP_IN] = { .n = IST("http_comp_bytes_in_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_COMP_OUT] = { .n = IST("http_comp_bytes_out_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_COMP_BYP] = { .n = IST("http_comp_bytes_bypassed_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_COMP_RSP] = { .n = IST("http_comp_responses_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_LASTSESS] = { .n = IST("last_session_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + //[ST_I_PX_LAST_CHK] ignored + //[ST_I_PX_LAST_AGT] ignored + [ST_I_PX_QTIME] = { .n = IST("queue_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CTIME] = { .n = IST("connect_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_RTIME] = { .n = IST("response_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_TTIME] = { .n = IST("total_time_average_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + //[ST_I_PX_AGENT_STATUS] ignored + //[ST_I_PX_AGENT_CODE] ignored + //[ST_I_PX_AGENT_DURATION] ignored + //[ST_I_PX_CHECK_DESC] ignored + //[ST_I_PX_AGENT_DESC] ignored + //[ST_I_PX_CHECK_RISE] ignored + //[ST_I_PX_CHECK_FALL] ignored + //[ST_I_PX_CHECK_HEALTH] ignored + //[ST_I_PX_AGENT_RISE] ignored + //[ST_I_PX_AGENT_FALL] ignored + //[ST_I_PX_AGENT_HEALTH] ignored + //[ST_I_PX_ADDR] ignored + //[ST_I_PX_COOKIE] ignored + //[ST_I_PX_MODE] ignored + //[ST_I_PX_ALGO] ignored + //[ST_I_PX_CONN_RATE] ignored + [ST_I_PX_CONN_RATE_MAX] = { .n = IST("connections_rate_max"), .type = PROMEX_MT_GAUGE, .flags = (PROMEX_FL_FRONT_METRIC ) }, + [ST_I_PX_CONN_TOT] = { .n = IST("connections_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC ) }, + [ST_I_PX_INTERCEPTED] = { .n = IST("intercepted_requests_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC ) }, + [ST_I_PX_DCON] = { .n = IST("denied_connections_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC ) }, + [ST_I_PX_DSES] = { .n = IST("denied_sessions_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC ) }, + [ST_I_PX_WREW] = { .n = IST("failed_header_rewriting_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CONNECT] = { .n = IST("connection_attempts_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_REUSE] = { .n = IST("connection_reuses_total"), .type = PROMEX_MT_COUNTER, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CACHE_LOOKUPS] = { .n = IST("http_cache_lookups_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_CACHE_HITS] = { .n = IST("http_cache_hits_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_SRV_ICUR] = { .n = IST("idle_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_SRV_ILIM] = { .n = IST("idle_connections_limit"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_QT_MAX] = { .n = IST("max_queue_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_CT_MAX] = { .n = IST("max_connect_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_RT_MAX] = { .n = IST("max_response_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_TT_MAX] = { .n = IST("max_total_time_seconds"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_EINT] = { .n = IST("internal_errors_total"), .type = PROMEX_MT_COUNTER, .flags = (PROMEX_FL_FRONT_METRIC | PROMEX_FL_LI_METRIC | PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_IDLE_CONN_CUR] = { .n = IST("unsafe_idle_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_SAFE_CONN_CUR] = { .n = IST("safe_idle_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_USED_CONN_CUR] = { .n = IST("used_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_NEED_CONN_EST] = { .n = IST("need_connections_current"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_UWEIGHT] = { .n = IST("uweight"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) }, + [ST_I_PX_AGG_SRV_CHECK_STATUS] = { .n = IST("agg_server_check_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_AGG_SRV_STATUS ] = { .n = IST("agg_server_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC ) }, + [ST_I_PX_AGG_CHECK_STATUS] = { .n = IST("agg_check_status"), .type = PROMEX_MT_GAUGE, .flags = ( PROMEX_FL_BACK_METRIC ) }, }; /* Specialized frontend metric names, to override default ones */ -const struct ist promex_st_front_metrics_names[ST_F_TOTAL_FIELDS] = { +const struct ist promex_st_front_metrics_names[ST_I_PX_MAX] = { }; /* Specialized backend metric names, to override default ones */ -const struct ist promex_st_back_metrics_names[ST_F_TOTAL_FIELDS] = { +const struct ist promex_st_back_metrics_names[ST_I_PX_MAX] = { }; /* Specialized listener metric names, to override default ones */ -const struct ist promex_st_li_metrics_names[ST_F_TOTAL_FIELDS] = { +const struct ist promex_st_li_metrics_names[ST_I_PX_MAX] = { }; /* Specialized server metric names, to override default ones */ -const struct ist promex_st_srv_metrics_names[ST_F_TOTAL_FIELDS] = { - [ST_F_ACT] = IST("active"), - [ST_F_BCK] = IST("backup"), +const struct ist promex_st_srv_metrics_names[ST_I_PX_MAX] = { + [ST_I_PX_ACT] = IST("active"), + [ST_I_PX_BCK] = IST("backup"), }; /* Description of overridden stats fields */ -const struct ist promex_st_metric_desc[ST_F_TOTAL_FIELDS] = { - [ST_F_STATUS] = IST("Current status of the service, per state label value."), - [ST_F_CHECK_STATUS] = IST("Status of last health check, per state label value."), - [ST_F_CHECK_CODE] = IST("layer5-7 code, if available of the last health check."), - [ST_F_CHECK_DURATION] = IST("Total duration of the latest server health check, in seconds."), - [ST_F_QTIME] = IST("Avg. queue time for last 1024 successful connections."), - [ST_F_CTIME] = IST("Avg. connect time for last 1024 successful connections."), - [ST_F_RTIME] = IST("Avg. response time for last 1024 successful connections."), - [ST_F_TTIME] = IST("Avg. total time for last 1024 successful connections."), - [ST_F_QT_MAX] = IST("Maximum observed time spent in the queue"), - [ST_F_CT_MAX] = IST("Maximum observed time spent waiting for a connection to complete"), - [ST_F_RT_MAX] = IST("Maximum observed time spent waiting for a server response"), - [ST_F_TT_MAX] = IST("Maximum observed total request+response time (request+queue+connect+response+processing)"), +const struct ist promex_st_metric_desc[ST_I_PX_MAX] = { + [ST_I_PX_STATUS] = IST("Current status of the service, per state label value."), + [ST_I_PX_CHECK_STATUS] = IST("Status of last health check, per state label value."), + [ST_I_PX_CHECK_CODE] = IST("layer5-7 code, if available of the last health check."), + [ST_I_PX_CHECK_DURATION] = IST("Total duration of the latest server health check, in seconds."), + [ST_I_PX_QTIME] = IST("Avg. queue time for last 1024 successful connections."), + [ST_I_PX_CTIME] = IST("Avg. connect time for last 1024 successful connections."), + [ST_I_PX_RTIME] = IST("Avg. response time for last 1024 successful connections."), + [ST_I_PX_TTIME] = IST("Avg. total time for last 1024 successful connections."), + [ST_I_PX_QT_MAX] = IST("Maximum observed time spent in the queue"), + [ST_I_PX_CT_MAX] = IST("Maximum observed time spent waiting for a connection to complete"), + [ST_I_PX_RT_MAX] = IST("Maximum observed time spent waiting for a server response"), + [ST_I_PX_TT_MAX] = IST("Maximum observed total request+response time (request+queue+connect+response+processing)"), }; -/* Specific labels for all ST_F_HRSP_* fields */ -const struct ist promex_hrsp_code[1 + ST_F_HRSP_OTHER - ST_F_HRSP_1XX] = { - [ST_F_HRSP_1XX - ST_F_HRSP_1XX] = IST("1xx"), - [ST_F_HRSP_2XX - ST_F_HRSP_1XX] = IST("2xx"), - [ST_F_HRSP_3XX - ST_F_HRSP_1XX] = IST("3xx"), - [ST_F_HRSP_4XX - ST_F_HRSP_1XX] = IST("4xx"), - [ST_F_HRSP_5XX - ST_F_HRSP_1XX] = IST("5xx"), - [ST_F_HRSP_OTHER - ST_F_HRSP_1XX] = IST("other"), +/* Specific labels for all ST_I_PX_HRSP_* fields */ +const struct ist promex_hrsp_code[1 + ST_I_PX_HRSP_OTHER - ST_I_PX_HRSP_1XX] = { + [ST_I_PX_HRSP_1XX - ST_I_PX_HRSP_1XX] = IST("1xx"), + [ST_I_PX_HRSP_2XX - ST_I_PX_HRSP_1XX] = IST("2xx"), + [ST_I_PX_HRSP_3XX - ST_I_PX_HRSP_1XX] = IST("3xx"), + [ST_I_PX_HRSP_4XX - ST_I_PX_HRSP_1XX] = IST("4xx"), + [ST_I_PX_HRSP_5XX - ST_I_PX_HRSP_1XX] = IST("5xx"), + [ST_I_PX_HRSP_OTHER - ST_I_PX_HRSP_1XX] = IST("other"), }; enum promex_front_state { @@ -631,7 +631,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx) int ret = 1; enum promex_front_state state; - for (;ctx->field_num < ST_F_TOTAL_FIELDS; ctx->field_num++) { + for (;ctx->field_num < ST_I_PX_MAX; ctx->field_num++) { if (!(promex_st_metrics[ctx->field_num].flags & ctx->flags)) continue; @@ -641,7 +641,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx) if (!isttest(name)) name = promex_st_metrics[ctx->field_num].n; if (!isttest(desc)) - desc = ist(stat_fields[ctx->field_num].desc); + desc = ist(metrics_px[ctx->field_num].desc); if (promex_filter_metric(appctx, prefix, name)) continue; @@ -659,11 +659,11 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx) if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_FE)) goto next_px; - if (!stats_fill_fe_stats(px, stats, ST_F_TOTAL_FIELDS, &(ctx->field_num))) + if (!stats_fill_fe_stats(px, stats, ST_I_PX_MAX, &(ctx->field_num))) return -1; switch (ctx->field_num) { - case ST_F_STATUS: + case ST_I_PX_STATUS: state = !(px->flags & PR_FL_STOPPED); for (; ctx->obj_state < PROMEX_FRONT_STATE_COUNT; ctx->obj_state++) { labels[1].name = ist("state"); @@ -677,31 +677,31 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx) } ctx->obj_state = 0; goto next_px; - case ST_F_REQ_RATE_MAX: - case ST_F_REQ_TOT: - case ST_F_INTERCEPTED: - case ST_F_CACHE_LOOKUPS: - case ST_F_CACHE_HITS: - case ST_F_COMP_IN: - case ST_F_COMP_OUT: - case ST_F_COMP_BYP: - case ST_F_COMP_RSP: + case ST_I_PX_REQ_RATE_MAX: + case ST_I_PX_REQ_TOT: + case ST_I_PX_INTERCEPTED: + case ST_I_PX_CACHE_LOOKUPS: + case ST_I_PX_CACHE_HITS: + case ST_I_PX_COMP_IN: + case ST_I_PX_COMP_OUT: + case ST_I_PX_COMP_BYP: + case ST_I_PX_COMP_RSP: if (px->mode != PR_MODE_HTTP) goto next_px; val = stats[ctx->field_num]; break; - case ST_F_HRSP_1XX: - case ST_F_HRSP_2XX: - case ST_F_HRSP_3XX: - case ST_F_HRSP_4XX: - case ST_F_HRSP_5XX: - case ST_F_HRSP_OTHER: + case ST_I_PX_HRSP_1XX: + case ST_I_PX_HRSP_2XX: + case ST_I_PX_HRSP_3XX: + case ST_I_PX_HRSP_4XX: + case ST_I_PX_HRSP_5XX: + case ST_I_PX_HRSP_OTHER: if (px->mode != PR_MODE_HTTP) goto next_px; - if (ctx->field_num != ST_F_HRSP_1XX) + if (ctx->field_num != ST_I_PX_HRSP_1XX) ctx->flags &= ~PROMEX_FL_METRIC_HDR; labels[1].name = ist("code"); - labels[1].value = promex_hrsp_code[ctx->field_num - ST_F_HRSP_1XX]; + labels[1].value = promex_hrsp_code[ctx->field_num - ST_I_PX_HRSP_1XX]; val = stats[ctx->field_num]; break; @@ -818,7 +818,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx) int ret = 1; enum li_status status; - for (;ctx->field_num < ST_F_TOTAL_FIELDS; ctx->field_num++) { + for (;ctx->field_num < ST_I_PX_MAX; ctx->field_num++) { if (!(promex_st_metrics[ctx->field_num].flags & ctx->flags)) continue; @@ -828,7 +828,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx) if (!isttest(name)) name = promex_st_metrics[ctx->field_num].n; if (!isttest(desc)) - desc = ist(stat_fields[ctx->field_num].desc); + desc = ist(metrics_px[ctx->field_num].desc); if (promex_filter_metric(appctx, prefix, name)) continue; @@ -857,11 +857,11 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx) labels[1].value = ist2(li->name, strlen(li->name)); if (!stats_fill_li_stats(px, li, 0, stats, - ST_F_TOTAL_FIELDS, &(ctx->field_num))) + ST_I_PX_MAX, &(ctx->field_num))) return -1; switch (ctx->field_num) { - case ST_F_STATUS: + case ST_I_PX_STATUS: status = get_li_status(li); for (; ctx->obj_state < LI_STATE_COUNT; ctx->obj_state++) { val = mkf_u32(FO_STATUS, status == ctx->obj_state); @@ -1006,7 +1006,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx) enum promex_srv_state srv_state; enum healthcheck_status srv_check_status; - for (;ctx->field_num < ST_F_TOTAL_FIELDS; ctx->field_num++) { + for (;ctx->field_num < ST_I_PX_MAX; ctx->field_num++) { if (!(promex_st_metrics[ctx->field_num].flags & ctx->flags)) continue; @@ -1016,7 +1016,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx) if (!isttest(name)) name = promex_st_metrics[ctx->field_num].n; if (!isttest(desc)) - desc = ist(stat_fields[ctx->field_num].desc); + desc = ist(metrics_px[ctx->field_num].desc); if (promex_filter_metric(appctx, prefix, name)) continue; @@ -1037,12 +1037,12 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx) if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_BE)) goto next_px; - if (!stats_fill_be_stats(px, 0, stats, ST_F_TOTAL_FIELDS, &(ctx->field_num))) + if (!stats_fill_be_stats(px, 0, stats, ST_I_PX_MAX, &(ctx->field_num))) return -1; switch (ctx->field_num) { - case ST_F_AGG_SRV_CHECK_STATUS: // DEPRECATED - case ST_F_AGG_SRV_STATUS: + case ST_I_PX_AGG_SRV_CHECK_STATUS: // DEPRECATED + case ST_I_PX_AGG_SRV_STATUS: if (!px->srv) goto next_px; sv = px->srv; @@ -1062,7 +1062,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx) } ctx->obj_state = 0; goto next_px; - case ST_F_AGG_CHECK_STATUS: + case ST_I_PX_AGG_CHECK_STATUS: if (!px->srv) goto next_px; sv = px->srv; @@ -1087,7 +1087,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx) } ctx->obj_state = 0; goto next_px; - case ST_F_STATUS: + case ST_I_PX_STATUS: bkd_state = ((px->lbprm.tot_weight > 0 || !px->srv) ? 1 : 0); for (; ctx->obj_state < PROMEX_BACK_STATE_COUNT; ctx->obj_state++) { labels[1].name = ist("state"); @@ -1100,61 +1100,61 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx) } ctx->obj_state = 0; goto next_px; - case ST_F_QTIME: + case ST_I_PX_QTIME: secs = (double)swrate_avg(px->be_counters.q_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_CTIME: + case ST_I_PX_CTIME: secs = (double)swrate_avg(px->be_counters.c_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_RTIME: + case ST_I_PX_RTIME: secs = (double)swrate_avg(px->be_counters.d_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_TTIME: + case ST_I_PX_TTIME: secs = (double)swrate_avg(px->be_counters.t_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_QT_MAX: + case ST_I_PX_QT_MAX: secs = (double)px->be_counters.qtime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_CT_MAX: + case ST_I_PX_CT_MAX: secs = (double)px->be_counters.ctime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_RT_MAX: + case ST_I_PX_RT_MAX: secs = (double)px->be_counters.dtime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_TT_MAX: + case ST_I_PX_TT_MAX: secs = (double)px->be_counters.ttime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_REQ_TOT: - case ST_F_CACHE_LOOKUPS: - case ST_F_CACHE_HITS: - case ST_F_COMP_IN: - case ST_F_COMP_OUT: - case ST_F_COMP_BYP: - case ST_F_COMP_RSP: + case ST_I_PX_REQ_TOT: + case ST_I_PX_CACHE_LOOKUPS: + case ST_I_PX_CACHE_HITS: + case ST_I_PX_COMP_IN: + case ST_I_PX_COMP_OUT: + case ST_I_PX_COMP_BYP: + case ST_I_PX_COMP_RSP: if (px->mode != PR_MODE_HTTP) goto next_px; val = stats[ctx->field_num]; break; - case ST_F_HRSP_1XX: - case ST_F_HRSP_2XX: - case ST_F_HRSP_3XX: - case ST_F_HRSP_4XX: - case ST_F_HRSP_5XX: - case ST_F_HRSP_OTHER: + case ST_I_PX_HRSP_1XX: + case ST_I_PX_HRSP_2XX: + case ST_I_PX_HRSP_3XX: + case ST_I_PX_HRSP_4XX: + case ST_I_PX_HRSP_5XX: + case ST_I_PX_HRSP_OTHER: if (px->mode != PR_MODE_HTTP) goto next_px; - if (ctx->field_num != ST_F_HRSP_1XX) + if (ctx->field_num != ST_I_PX_HRSP_1XX) ctx->flags &= ~PROMEX_FL_METRIC_HDR; labels[1].name = ist("code"); - labels[1].value = promex_hrsp_code[ctx->field_num - ST_F_HRSP_1XX]; + labels[1].value = promex_hrsp_code[ctx->field_num - ST_I_PX_HRSP_1XX]; val = stats[ctx->field_num]; break; @@ -1272,7 +1272,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx) enum promex_srv_state state; const char *check_state; - for (;ctx->field_num < ST_F_TOTAL_FIELDS; ctx->field_num++) { + for (;ctx->field_num < ST_I_PX_MAX; ctx->field_num++) { if (!(promex_st_metrics[ctx->field_num].flags & ctx->flags)) continue; @@ -1282,7 +1282,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx) if (!isttest(name)) name = promex_st_metrics[ctx->field_num].n; if (!isttest(desc)) - desc = ist(stat_fields[ctx->field_num].desc); + desc = ist(metrics_px[ctx->field_num].desc); if (promex_filter_metric(appctx, prefix, name)) continue; @@ -1307,14 +1307,14 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx) labels[1].name = ist("server"); labels[1].value = ist2(sv->id, strlen(sv->id)); - if (!stats_fill_sv_stats(px, sv, 0, stats, ST_F_TOTAL_FIELDS, &(ctx->field_num))) + if (!stats_fill_sv_stats(px, sv, 0, stats, ST_I_PX_MAX, &(ctx->field_num))) return -1; if ((ctx->flags & PROMEX_FL_NO_MAINT_SRV) && (sv->cur_admin & SRV_ADMF_MAINT)) goto next_sv; switch (ctx->field_num) { - case ST_F_STATUS: + case ST_I_PX_STATUS: state = promex_srv_status(sv); for (; ctx->obj_state < PROMEX_SRV_STATE_COUNT; ctx->obj_state++) { val = mkf_u32(FO_STATUS, state == ctx->obj_state); @@ -1327,39 +1327,39 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx) } ctx->obj_state = 0; goto next_sv; - case ST_F_QTIME: + case ST_I_PX_QTIME: secs = (double)swrate_avg(sv->counters.q_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_CTIME: + case ST_I_PX_CTIME: secs = (double)swrate_avg(sv->counters.c_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_RTIME: + case ST_I_PX_RTIME: secs = (double)swrate_avg(sv->counters.d_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_TTIME: + case ST_I_PX_TTIME: secs = (double)swrate_avg(sv->counters.t_time, TIME_STATS_SAMPLES) / 1000.0; val = mkf_flt(FN_AVG, secs); break; - case ST_F_QT_MAX: + case ST_I_PX_QT_MAX: secs = (double)sv->counters.qtime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_CT_MAX: + case ST_I_PX_CT_MAX: secs = (double)sv->counters.ctime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_RT_MAX: + case ST_I_PX_RT_MAX: secs = (double)sv->counters.dtime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_TT_MAX: + case ST_I_PX_TT_MAX: secs = (double)sv->counters.ttime_max / 1000.0; val = mkf_flt(FN_MAX, secs); break; - case ST_F_CHECK_STATUS: + case ST_I_PX_CHECK_STATUS: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) != CHK_ST_ENABLED) goto next_sv; @@ -1377,38 +1377,38 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx) } ctx->obj_state = 0; goto next_sv; - case ST_F_CHECK_CODE: + case ST_I_PX_CHECK_CODE: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) != CHK_ST_ENABLED) goto next_sv; val = mkf_u32(FN_OUTPUT, (sv->check.status < HCHK_STATUS_L57DATA) ? 0 : sv->check.code); break; - case ST_F_CHECK_DURATION: + case ST_I_PX_CHECK_DURATION: if (sv->check.status < HCHK_STATUS_CHECKED) goto next_sv; secs = (double)sv->check.duration / 1000.0; val = mkf_flt(FN_DURATION, secs); break; - case ST_F_REQ_TOT: + case ST_I_PX_REQ_TOT: if (px->mode != PR_MODE_HTTP) { sv = NULL; goto next_px; } val = stats[ctx->field_num]; break; - case ST_F_HRSP_1XX: - case ST_F_HRSP_2XX: - case ST_F_HRSP_3XX: - case ST_F_HRSP_4XX: - case ST_F_HRSP_5XX: - case ST_F_HRSP_OTHER: + case ST_I_PX_HRSP_1XX: + case ST_I_PX_HRSP_2XX: + case ST_I_PX_HRSP_3XX: + case ST_I_PX_HRSP_4XX: + case ST_I_PX_HRSP_5XX: + case ST_I_PX_HRSP_OTHER: if (px->mode != PR_MODE_HTTP) { sv = NULL; goto next_px; } - if (ctx->field_num != ST_F_HRSP_1XX) + if (ctx->field_num != ST_I_PX_HRSP_1XX) ctx->flags &= ~PROMEX_FL_METRIC_HDR; labels[2].name = ist("code"); - labels[2].value = promex_hrsp_code[ctx->field_num - ST_F_HRSP_1XX]; + labels[2].value = promex_hrsp_code[ctx->field_num - ST_I_PX_HRSP_1XX]; val = stats[ctx->field_num]; break; @@ -1720,7 +1720,7 @@ static int promex_dump_metrics(struct appctx *appctx, struct stconn *sc, struct ctx->flags &= ~PROMEX_FL_INFO_METRIC; ctx->flags |= (PROMEX_FL_METRIC_HDR|PROMEX_FL_FRONT_METRIC); ctx->obj_state = 0; - ctx->field_num = ST_F_PXNAME; + ctx->field_num = ST_I_PX_PXNAME; ctx->mod_field_num = 0; appctx->st1 = PROMEX_DUMPER_FRONT; __fallthrough; @@ -1738,7 +1738,7 @@ static int promex_dump_metrics(struct appctx *appctx, struct stconn *sc, struct ctx->flags &= ~PROMEX_FL_FRONT_METRIC; ctx->flags |= (PROMEX_FL_METRIC_HDR|PROMEX_FL_LI_METRIC); ctx->obj_state = 0; - ctx->field_num = ST_F_PXNAME; + ctx->field_num = ST_I_PX_PXNAME; ctx->mod_field_num = 0; appctx->st1 = PROMEX_DUMPER_LI; __fallthrough; @@ -1756,7 +1756,7 @@ static int promex_dump_metrics(struct appctx *appctx, struct stconn *sc, struct ctx->flags &= ~PROMEX_FL_LI_METRIC; ctx->flags |= (PROMEX_FL_METRIC_HDR|PROMEX_FL_BACK_METRIC); ctx->obj_state = 0; - ctx->field_num = ST_F_PXNAME; + ctx->field_num = ST_I_PX_PXNAME; ctx->mod_field_num = 0; appctx->st1 = PROMEX_DUMPER_BACK; __fallthrough; @@ -1774,7 +1774,7 @@ static int promex_dump_metrics(struct appctx *appctx, struct stconn *sc, struct ctx->flags &= ~PROMEX_FL_BACK_METRIC; ctx->flags |= (PROMEX_FL_METRIC_HDR|PROMEX_FL_SRV_METRIC); ctx->obj_state = 0; - ctx->field_num = ST_F_PXNAME; + ctx->field_num = ST_I_PX_PXNAME; ctx->mod_field_num = 0; appctx->st1 = PROMEX_DUMPER_SRV; __fallthrough; diff --git a/include/haproxy/stats-t.h b/include/haproxy/stats-t.h index 6f07a5812..a5fd244ef 100644 --- a/include/haproxy/stats-t.h +++ b/include/haproxy/stats-t.h @@ -339,129 +339,129 @@ enum info_field { /* Stats fields for CSV output. For any field added here, please add the text - * representation in the stat_fields array. Please only append at the end, - * before the ST_F_TOTAL_FIELDS entry, and never insert anything in the middle + * representation in the metrics_px array. Please only append at the end, + * before the ST_I_PX_MAX entry, and never insert anything in the middle * nor at the beginning.When adding an entry here, one must always add a - * corresponding one in stat_fields[] otherwise Lua's get_stats() will break, + * corresponding one in metrics_px[] otherwise Lua's get_stats() will break, * and "show stats" will show a null. */ enum stat_field { - ST_F_PXNAME, - ST_F_SVNAME, - ST_F_QCUR, - ST_F_QMAX, - ST_F_SCUR, - ST_F_SMAX, - ST_F_SLIM, - ST_F_STOT, - ST_F_BIN , - ST_F_BOUT, - ST_F_DREQ, - ST_F_DRESP, - ST_F_EREQ, - ST_F_ECON, - ST_F_ERESP, - ST_F_WRETR, - ST_F_WREDIS, - ST_F_STATUS, - ST_F_WEIGHT, - ST_F_ACT, - ST_F_BCK, - ST_F_CHKFAIL, - ST_F_CHKDOWN, - ST_F_LASTCHG, - ST_F_DOWNTIME, - ST_F_QLIMIT, - ST_F_PID, - ST_F_IID, - ST_F_SID, - ST_F_THROTTLE, - ST_F_LBTOT, - ST_F_TRACKED, - ST_F_TYPE, - ST_F_RATE, - ST_F_RATE_LIM, - ST_F_RATE_MAX, - ST_F_CHECK_STATUS, - ST_F_CHECK_CODE, - ST_F_CHECK_DURATION, - ST_F_HRSP_1XX, - ST_F_HRSP_2XX, - ST_F_HRSP_3XX, - ST_F_HRSP_4XX, - ST_F_HRSP_5XX, - ST_F_HRSP_OTHER, - ST_F_HANAFAIL, - ST_F_REQ_RATE, - ST_F_REQ_RATE_MAX, - ST_F_REQ_TOT, - ST_F_CLI_ABRT, - ST_F_SRV_ABRT, - ST_F_COMP_IN, - ST_F_COMP_OUT, - ST_F_COMP_BYP, - ST_F_COMP_RSP, - ST_F_LASTSESS, - ST_F_LAST_CHK, - ST_F_LAST_AGT, - ST_F_QTIME, - ST_F_CTIME, - ST_F_RTIME, - ST_F_TTIME, - ST_F_AGENT_STATUS, - ST_F_AGENT_CODE, - ST_F_AGENT_DURATION, - ST_F_CHECK_DESC, - ST_F_AGENT_DESC, - ST_F_CHECK_RISE, - ST_F_CHECK_FALL, - ST_F_CHECK_HEALTH, - ST_F_AGENT_RISE, - ST_F_AGENT_FALL, - ST_F_AGENT_HEALTH, - ST_F_ADDR, - ST_F_COOKIE, - ST_F_MODE, - ST_F_ALGO, - ST_F_CONN_RATE, - ST_F_CONN_RATE_MAX, - ST_F_CONN_TOT, - ST_F_INTERCEPTED, - ST_F_DCON, - ST_F_DSES, - ST_F_WREW, - ST_F_CONNECT, - ST_F_REUSE, - ST_F_CACHE_LOOKUPS, - ST_F_CACHE_HITS, - ST_F_SRV_ICUR, - ST_F_SRV_ILIM, - ST_F_QT_MAX, - ST_F_CT_MAX, - ST_F_RT_MAX, - ST_F_TT_MAX, - ST_F_EINT, - ST_F_IDLE_CONN_CUR, - ST_F_SAFE_CONN_CUR, - ST_F_USED_CONN_CUR, - ST_F_NEED_CONN_EST, - ST_F_UWEIGHT, - ST_F_AGG_SRV_STATUS, - ST_F_AGG_SRV_CHECK_STATUS, - ST_F_AGG_CHECK_STATUS, - ST_F_SRID, - ST_F_SESS_OTHER, - ST_F_H1SESS, - ST_F_H2SESS, - ST_F_H3SESS, - ST_F_REQ_OTHER, - ST_F_H1REQ, - ST_F_H2REQ, - ST_F_H3REQ, - ST_F_PROTO, + ST_I_PX_PXNAME, + ST_I_PX_SVNAME, + ST_I_PX_QCUR, + ST_I_PX_QMAX, + ST_I_PX_SCUR, + ST_I_PX_SMAX, + ST_I_PX_SLIM, + ST_I_PX_STOT, + ST_I_PX_BIN , + ST_I_PX_BOUT, + ST_I_PX_DREQ, + ST_I_PX_DRESP, + ST_I_PX_EREQ, + ST_I_PX_ECON, + ST_I_PX_ERESP, + ST_I_PX_WRETR, + ST_I_PX_WREDIS, + ST_I_PX_STATUS, + ST_I_PX_WEIGHT, + ST_I_PX_ACT, + ST_I_PX_BCK, + ST_I_PX_CHKFAIL, + ST_I_PX_CHKDOWN, + ST_I_PX_LASTCHG, + ST_I_PX_DOWNTIME, + ST_I_PX_QLIMIT, + ST_I_PX_PID, + ST_I_PX_IID, + ST_I_PX_SID, + ST_I_PX_THROTTLE, + ST_I_PX_LBTOT, + ST_I_PX_TRACKED, + ST_I_PX_TYPE, + ST_I_PX_RATE, + ST_I_PX_RATE_LIM, + ST_I_PX_RATE_MAX, + ST_I_PX_CHECK_STATUS, + ST_I_PX_CHECK_CODE, + ST_I_PX_CHECK_DURATION, + ST_I_PX_HRSP_1XX, + ST_I_PX_HRSP_2XX, + ST_I_PX_HRSP_3XX, + ST_I_PX_HRSP_4XX, + ST_I_PX_HRSP_5XX, + ST_I_PX_HRSP_OTHER, + ST_I_PX_HANAFAIL, + ST_I_PX_REQ_RATE, + ST_I_PX_REQ_RATE_MAX, + ST_I_PX_REQ_TOT, + ST_I_PX_CLI_ABRT, + ST_I_PX_SRV_ABRT, + ST_I_PX_COMP_IN, + ST_I_PX_COMP_OUT, + ST_I_PX_COMP_BYP, + ST_I_PX_COMP_RSP, + ST_I_PX_LASTSESS, + ST_I_PX_LAST_CHK, + ST_I_PX_LAST_AGT, + ST_I_PX_QTIME, + ST_I_PX_CTIME, + ST_I_PX_RTIME, + ST_I_PX_TTIME, + ST_I_PX_AGENT_STATUS, + ST_I_PX_AGENT_CODE, + ST_I_PX_AGENT_DURATION, + ST_I_PX_CHECK_DESC, + ST_I_PX_AGENT_DESC, + ST_I_PX_CHECK_RISE, + ST_I_PX_CHECK_FALL, + ST_I_PX_CHECK_HEALTH, + ST_I_PX_AGENT_RISE, + ST_I_PX_AGENT_FALL, + ST_I_PX_AGENT_HEALTH, + ST_I_PX_ADDR, + ST_I_PX_COOKIE, + ST_I_PX_MODE, + ST_I_PX_ALGO, + ST_I_PX_CONN_RATE, + ST_I_PX_CONN_RATE_MAX, + ST_I_PX_CONN_TOT, + ST_I_PX_INTERCEPTED, + ST_I_PX_DCON, + ST_I_PX_DSES, + ST_I_PX_WREW, + ST_I_PX_CONNECT, + ST_I_PX_REUSE, + ST_I_PX_CACHE_LOOKUPS, + ST_I_PX_CACHE_HITS, + ST_I_PX_SRV_ICUR, + ST_I_PX_SRV_ILIM, + ST_I_PX_QT_MAX, + ST_I_PX_CT_MAX, + ST_I_PX_RT_MAX, + ST_I_PX_TT_MAX, + ST_I_PX_EINT, + ST_I_PX_IDLE_CONN_CUR, + ST_I_PX_SAFE_CONN_CUR, + ST_I_PX_USED_CONN_CUR, + ST_I_PX_NEED_CONN_EST, + ST_I_PX_UWEIGHT, + ST_I_PX_AGG_SRV_STATUS, + ST_I_PX_AGG_SRV_CHECK_STATUS, + ST_I_PX_AGG_CHECK_STATUS, + ST_I_PX_SRID, + ST_I_PX_SESS_OTHER, + ST_I_PX_H1SESS, + ST_I_PX_H2SESS, + ST_I_PX_H3SESS, + ST_I_PX_REQ_OTHER, + ST_I_PX_H1REQ, + ST_I_PX_H2REQ, + ST_I_PX_H3REQ, + ST_I_PX_PROTO, /* must always be the last one */ - ST_F_TOTAL_FIELDS + ST_I_PX_MAX }; /* Please consider updating stats_dump_fields_*(), diff --git a/include/haproxy/stats.h b/include/haproxy/stats.h index e86c1299d..b3379ae7d 100644 --- a/include/haproxy/stats.h +++ b/include/haproxy/stats.h @@ -38,7 +38,7 @@ struct stconn; /* These two structs contains all field names and descriptions according to * the the number of entries in "enum stat_field" and "enum info_field" */ -extern const struct name_desc stat_fields[]; +extern const struct name_desc metrics_px[]; extern const struct name_desc info_fields[]; extern const char *stat_status_codes[]; extern struct applet http_stats_applet; diff --git a/reg-tests/webstats/missing-stats-fields.vtc b/reg-tests/webstats/missing-stats-fields.vtc index c85855d5f..8b292c386 100644 --- a/reg-tests/webstats/missing-stats-fields.vtc +++ b/reg-tests/webstats/missing-stats-fields.vtc @@ -1,6 +1,6 @@ varnishtest "Verifies the absence of (null) in 'show stats' header" -# This can happen if a new ST_F_xxx enum is added without updating +# This can happen if a new ST_I_PX_xxx enum is added without updating # stats_fields[]. feature ignore_unknown_macro diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index 96ec85b21..fde5ad8a9 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -53,7 +53,7 @@ static int class_stktable_ref; static int class_proxy_list_ref; static int class_server_list_ref; -#define STATS_LEN (MAX((int)ST_F_TOTAL_FIELDS, (int)INF_TOTAL_FIELDS)) +#define STATS_LEN (MAX((int)ST_I_PX_MAX, (int)INF_TOTAL_FIELDS)) static THREAD_LOCAL struct field stats[STATS_LEN]; @@ -1159,11 +1159,11 @@ int hlua_listener_get_stats(lua_State *L) } stats_fill_li_stats(li->bind_conf->frontend, li, STAT_SHLGNDS, stats, - STATS_LEN, NULL); + STATS_LEN, NULL); lua_newtable(L); - for (i=0; iflags; int i = 0, j = 0; - if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_FE) { + if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_FE) { chunk_appendf(out, /* name, queue */ ""); @@ -514,7 +514,7 @@ int stats_dump_fields_html(struct buffer *out, "Frontend" "" "", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_PXNAME)); + field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_PXNAME)); chunk_appendf(out, /* sessions rate : current */ @@ -522,14 +522,14 @@ int stats_dump_fields_html(struct buffer *out, "Current connection rate:%s/s" "Current session rate:%s/s" "", - U2H(stats[ST_F_RATE].u.u32), - U2H(stats[ST_F_CONN_RATE].u.u32), - U2H(stats[ST_F_RATE].u.u32)); + U2H(stats[ST_I_PX_RATE].u.u32), + U2H(stats[ST_I_PX_CONN_RATE].u.u32), + U2H(stats[ST_I_PX_RATE].u.u32)); - if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) + if (strcmp(field_str(stats, ST_I_PX_MODE), "http") == 0) chunk_appendf(out, "Current request rate:%s/s", - U2H(stats[ST_F_REQ_RATE].u.u32)); + U2H(stats[ST_I_PX_REQ_RATE].u.u32)); chunk_appendf(out, "" @@ -538,20 +538,20 @@ int stats_dump_fields_html(struct buffer *out, "Max connection rate:%s/s" "Max session rate:%s/s" "", - U2H(stats[ST_F_RATE_MAX].u.u32), - U2H(stats[ST_F_CONN_RATE_MAX].u.u32), - U2H(stats[ST_F_RATE_MAX].u.u32)); + U2H(stats[ST_I_PX_RATE_MAX].u.u32), + U2H(stats[ST_I_PX_CONN_RATE_MAX].u.u32), + U2H(stats[ST_I_PX_RATE_MAX].u.u32)); - if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) + if (strcmp(field_str(stats, ST_I_PX_MODE), "http") == 0) chunk_appendf(out, "Max request rate:%s/s", - U2H(stats[ST_F_REQ_RATE_MAX].u.u32)); + U2H(stats[ST_I_PX_REQ_RATE_MAX].u.u32)); chunk_appendf(out, "" /* sessions rate : limit */ "%s", - LIM2A(stats[ST_F_RATE_LIM].u.u32, "-")); + LIM2A(stats[ST_I_PX_RATE_LIM].u.u32, "-")); chunk_appendf(out, /* sessions: current, max, limit, total */ @@ -560,13 +560,13 @@ int stats_dump_fields_html(struct buffer *out, "Cum. connections:%s" "Cum. sessions:%s" "", - U2H(stats[ST_F_SCUR].u.u32), U2H(stats[ST_F_SMAX].u.u32), U2H(stats[ST_F_SLIM].u.u32), - U2H(stats[ST_F_STOT].u.u64), - U2H(stats[ST_F_CONN_TOT].u.u64), - U2H(stats[ST_F_STOT].u.u64)); + U2H(stats[ST_I_PX_SCUR].u.u32), U2H(stats[ST_I_PX_SMAX].u.u32), U2H(stats[ST_I_PX_SLIM].u.u32), + U2H(stats[ST_I_PX_STOT].u.u64), + U2H(stats[ST_I_PX_CONN_TOT].u.u64), + U2H(stats[ST_I_PX_STOT].u.u64)); /* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */ - if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) { + if (strcmp(field_str(stats, ST_I_PX_MODE), "http") == 0) { chunk_appendf(out, "- HTTP/1 sessions:%s" "- HTTP/2 sessions:%s" @@ -578,15 +578,15 @@ int stats_dump_fields_html(struct buffer *out, "- HTTP/3 requests:%s" "- other requests:%s" "", - U2H(stats[ST_F_H1SESS].u.u64), - U2H(stats[ST_F_H2SESS].u.u64), - U2H(stats[ST_F_H3SESS].u.u64), - U2H(stats[ST_F_SESS_OTHER].u.u64), - U2H(stats[ST_F_REQ_TOT].u.u64), - U2H(stats[ST_F_H1REQ].u.u64), - U2H(stats[ST_F_H2REQ].u.u64), - U2H(stats[ST_F_H3REQ].u.u64), - U2H(stats[ST_F_REQ_OTHER].u.u64)); + U2H(stats[ST_I_PX_H1SESS].u.u64), + U2H(stats[ST_I_PX_H2SESS].u.u64), + U2H(stats[ST_I_PX_H3SESS].u.u64), + U2H(stats[ST_I_PX_SESS_OTHER].u.u64), + U2H(stats[ST_I_PX_REQ_TOT].u.u64), + U2H(stats[ST_I_PX_H1REQ].u.u64), + U2H(stats[ST_I_PX_H2REQ].u.u64), + U2H(stats[ST_I_PX_H3REQ].u.u64), + U2H(stats[ST_I_PX_REQ_OTHER].u.u64)); chunk_appendf(out, "- HTTP 1xx responses:%s" @@ -597,15 +597,15 @@ int stats_dump_fields_html(struct buffer *out, "- HTTP 5xx responses:%s" "- other responses:%s" "", - U2H(stats[ST_F_HRSP_1XX].u.u64), - U2H(stats[ST_F_HRSP_2XX].u.u64), - U2H(stats[ST_F_COMP_RSP].u.u64), - stats[ST_F_HRSP_2XX].u.u64 ? - (int)(100 * stats[ST_F_COMP_RSP].u.u64 / stats[ST_F_HRSP_2XX].u.u64) : 0, - U2H(stats[ST_F_HRSP_3XX].u.u64), - U2H(stats[ST_F_HRSP_4XX].u.u64), - U2H(stats[ST_F_HRSP_5XX].u.u64), - U2H(stats[ST_F_HRSP_OTHER].u.u64)); + U2H(stats[ST_I_PX_HRSP_1XX].u.u64), + U2H(stats[ST_I_PX_HRSP_2XX].u.u64), + U2H(stats[ST_I_PX_COMP_RSP].u.u64), + stats[ST_I_PX_HRSP_2XX].u.u64 ? + (int)(100 * stats[ST_I_PX_COMP_RSP].u.u64 / stats[ST_I_PX_HRSP_2XX].u.u64) : 0, + U2H(stats[ST_I_PX_HRSP_3XX].u.u64), + U2H(stats[ST_I_PX_HRSP_4XX].u.u64), + U2H(stats[ST_I_PX_HRSP_5XX].u.u64), + U2H(stats[ST_I_PX_HRSP_OTHER].u.u64)); chunk_appendf(out, "Intercepted requests:%s" @@ -614,13 +614,13 @@ int stats_dump_fields_html(struct buffer *out, "Failed hdr rewrites:%s" "Internal errors:%s" "", - U2H(stats[ST_F_INTERCEPTED].u.u64), - U2H(stats[ST_F_CACHE_LOOKUPS].u.u64), - U2H(stats[ST_F_CACHE_HITS].u.u64), - stats[ST_F_CACHE_LOOKUPS].u.u64 ? - (int)(100 * stats[ST_F_CACHE_HITS].u.u64 / stats[ST_F_CACHE_LOOKUPS].u.u64) : 0, - U2H(stats[ST_F_WREW].u.u64), - U2H(stats[ST_F_EINT].u.u64)); + U2H(stats[ST_I_PX_INTERCEPTED].u.u64), + U2H(stats[ST_I_PX_CACHE_LOOKUPS].u.u64), + U2H(stats[ST_I_PX_CACHE_HITS].u.u64), + stats[ST_I_PX_CACHE_LOOKUPS].u.u64 ? + (int)(100 * stats[ST_I_PX_CACHE_HITS].u.u64 / stats[ST_I_PX_CACHE_LOOKUPS].u.u64) : 0, + U2H(stats[ST_I_PX_WREW].u.u64), + U2H(stats[ST_I_PX_EINT].u.u64)); } chunk_appendf(out, @@ -630,7 +630,7 @@ int stats_dump_fields_html(struct buffer *out, /* bytes : in */ "%s" "", - U2H(stats[ST_F_BIN].u.u64)); + U2H(stats[ST_I_PX_BIN].u.u64)); chunk_appendf(out, /* bytes:out + compression stats (via hover): comp_in, comp_out, comp_byp */ @@ -641,16 +641,16 @@ int stats_dump_fields_html(struct buffer *out, "Compression bypass:%s" "Total bytes saved:%s(%d%%)" "%s", - (stats[ST_F_COMP_IN].u.u64 || stats[ST_F_COMP_BYP].u.u64) ? "":"", - U2H(stats[ST_F_BOUT].u.u64), - U2H(stats[ST_F_BOUT].u.u64), - U2H(stats[ST_F_COMP_IN].u.u64), - U2H(stats[ST_F_COMP_OUT].u.u64), - stats[ST_F_COMP_IN].u.u64 ? (int)(stats[ST_F_COMP_OUT].u.u64 * 100 / stats[ST_F_COMP_IN].u.u64) : 0, - U2H(stats[ST_F_COMP_BYP].u.u64), - U2H(stats[ST_F_COMP_IN].u.u64 - stats[ST_F_COMP_OUT].u.u64), - stats[ST_F_BOUT].u.u64 ? (int)((stats[ST_F_COMP_IN].u.u64 - stats[ST_F_COMP_OUT].u.u64) * 100 / stats[ST_F_BOUT].u.u64) : 0, - (stats[ST_F_COMP_IN].u.u64 || stats[ST_F_COMP_BYP].u.u64) ? "":""); + (stats[ST_I_PX_COMP_IN].u.u64 || stats[ST_I_PX_COMP_BYP].u.u64) ? "":"", + U2H(stats[ST_I_PX_BOUT].u.u64), + U2H(stats[ST_I_PX_BOUT].u.u64), + U2H(stats[ST_I_PX_COMP_IN].u.u64), + U2H(stats[ST_I_PX_COMP_OUT].u.u64), + stats[ST_I_PX_COMP_IN].u.u64 ? (int)(stats[ST_I_PX_COMP_OUT].u.u64 * 100 / stats[ST_I_PX_COMP_IN].u.u64) : 0, + U2H(stats[ST_I_PX_COMP_BYP].u.u64), + U2H(stats[ST_I_PX_COMP_IN].u.u64 - stats[ST_I_PX_COMP_OUT].u.u64), + stats[ST_I_PX_BOUT].u.u64 ? (int)((stats[ST_I_PX_COMP_IN].u.u64 - stats[ST_I_PX_COMP_OUT].u.u64) * 100 / stats[ST_I_PX_BOUT].u.u64) : 0, + (stats[ST_I_PX_COMP_IN].u.u64 || stats[ST_I_PX_COMP_BYP].u.u64) ? "":""); chunk_appendf(out, /* denied: req, resp */ @@ -664,9 +664,9 @@ int stats_dump_fields_html(struct buffer *out, /* rest of server: nothing */ "" "", - U2H(stats[ST_F_DREQ].u.u64), U2H(stats[ST_F_DRESP].u.u64), - U2H(stats[ST_F_EREQ].u.u64), - field_str(stats, ST_F_STATUS)); + U2H(stats[ST_I_PX_DREQ].u.u64), U2H(stats[ST_I_PX_DRESP].u.u64), + U2H(stats[ST_I_PX_EREQ].u.u64), + field_str(stats, ST_I_PX_STATUS)); if (flags & STAT_SHMODULES) { list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { @@ -679,7 +679,7 @@ int stats_dump_fields_html(struct buffer *out, for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "%s%s", - mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); + mod->stats[j].desc, field_to_html_str(&stats[ST_I_PX_MAX + i])); ++i; } chunk_appendf(out, ""); @@ -693,7 +693,7 @@ int stats_dump_fields_html(struct buffer *out, chunk_appendf(out, ""); } - else if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_SO) { + else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_SO) { chunk_appendf(out, ""); if (flags & STAT_ADMIN) { /* Column sub-heading for Enable or Disable server */ @@ -705,24 +705,24 @@ int stats_dump_fields_html(struct buffer *out, "%s" "%s" "", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), + field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), (flags & STAT_SHLGNDS)?"":"", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), field_str(stats, ST_F_SVNAME)); + field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), field_str(stats, ST_I_PX_SVNAME)); if (flags & STAT_SHLGNDS) { chunk_appendf(out, "
"); - if (isdigit((unsigned char)*field_str(stats, ST_F_ADDR))) - chunk_appendf(out, "IPv4: %s, ", field_str(stats, ST_F_ADDR)); - else if (*field_str(stats, ST_F_ADDR) == '[') - chunk_appendf(out, "IPv6: %s, ", field_str(stats, ST_F_ADDR)); - else if (*field_str(stats, ST_F_ADDR)) - chunk_appendf(out, "%s, ", field_str(stats, ST_F_ADDR)); + if (isdigit((unsigned char)*field_str(stats, ST_I_PX_ADDR))) + chunk_appendf(out, "IPv4: %s, ", field_str(stats, ST_I_PX_ADDR)); + else if (*field_str(stats, ST_I_PX_ADDR) == '[') + chunk_appendf(out, "IPv6: %s, ", field_str(stats, ST_I_PX_ADDR)); + else if (*field_str(stats, ST_I_PX_ADDR)) + chunk_appendf(out, "%s, ", field_str(stats, ST_I_PX_ADDR)); - chunk_appendf(out, "proto=%s, ", field_str(stats, ST_F_PROTO)); + chunk_appendf(out, "proto=%s, ", field_str(stats, ST_I_PX_PROTO)); /* id */ - chunk_appendf(out, "id: %d
", stats[ST_F_SID].u.u32); + chunk_appendf(out, "id: %d", stats[ST_I_PX_SID].u.u32); } chunk_appendf(out, @@ -737,8 +737,8 @@ int stats_dump_fields_html(struct buffer *out, "%s%s" "", (flags & STAT_SHLGNDS)?"
":"", - U2H(stats[ST_F_SCUR].u.u32), U2H(stats[ST_F_SMAX].u.u32), U2H(stats[ST_F_SLIM].u.u32), - U2H(stats[ST_F_STOT].u.u64), U2H(stats[ST_F_BIN].u.u64), U2H(stats[ST_F_BOUT].u.u64)); + U2H(stats[ST_I_PX_SCUR].u.u32), U2H(stats[ST_I_PX_SMAX].u.u32), U2H(stats[ST_I_PX_SLIM].u.u32), + U2H(stats[ST_I_PX_STOT].u.u64), U2H(stats[ST_I_PX_BIN].u.u64), U2H(stats[ST_I_PX_BOUT].u.u64)); chunk_appendf(out, /* denied: req, resp */ @@ -752,9 +752,9 @@ int stats_dump_fields_html(struct buffer *out, /* rest of server: nothing */ "" "", - U2H(stats[ST_F_DREQ].u.u64), U2H(stats[ST_F_DRESP].u.u64), - U2H(stats[ST_F_EREQ].u.u64), - field_str(stats, ST_F_STATUS)); + U2H(stats[ST_I_PX_DREQ].u.u64), U2H(stats[ST_I_PX_DRESP].u.u64), + U2H(stats[ST_I_PX_EREQ].u.u64), + field_str(stats, ST_I_PX_STATUS)); if (flags & STAT_SHMODULES) { list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { @@ -767,7 +767,7 @@ int stats_dump_fields_html(struct buffer *out, for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "%s%s", - mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); + mod->stats[j].desc, field_to_html_str(&stats[ST_I_PX_MAX + i])); ++i; } chunk_appendf(out, ""); @@ -781,7 +781,7 @@ int stats_dump_fields_html(struct buffer *out, chunk_appendf(out, ""); } - else if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_SV) { + else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_SV) { const char *style; /* determine the style to use depending on the server's state, @@ -791,29 +791,29 @@ int stats_dump_fields_html(struct buffer *out, * drain with the same color. */ - if (strcmp(field_str(stats, ST_F_STATUS), "DOWN") == 0 || - strcmp(field_str(stats, ST_F_STATUS), "DOWN (agent)") == 0) { + if (strcmp(field_str(stats, ST_I_PX_STATUS), "DOWN") == 0 || + strcmp(field_str(stats, ST_I_PX_STATUS), "DOWN (agent)") == 0) { style = "down"; } - else if (strncmp(field_str(stats, ST_F_STATUS), "DOWN ", strlen("DOWN ")) == 0) { + else if (strncmp(field_str(stats, ST_I_PX_STATUS), "DOWN ", strlen("DOWN ")) == 0) { style = "going_up"; } - else if (strcmp(field_str(stats, ST_F_STATUS), "DRAIN") == 0) { + else if (strcmp(field_str(stats, ST_I_PX_STATUS), "DRAIN") == 0) { style = "draining"; } - else if (strncmp(field_str(stats, ST_F_STATUS), "NOLB ", strlen("NOLB ")) == 0) { + else if (strncmp(field_str(stats, ST_I_PX_STATUS), "NOLB ", strlen("NOLB ")) == 0) { style = "going_down"; } - else if (strcmp(field_str(stats, ST_F_STATUS), "NOLB") == 0) { + else if (strcmp(field_str(stats, ST_I_PX_STATUS), "NOLB") == 0) { style = "nolb"; } - else if (strcmp(field_str(stats, ST_F_STATUS), "no check") == 0) { + else if (strcmp(field_str(stats, ST_I_PX_STATUS), "no check") == 0) { style = "no_check"; } - else if (!stats[ST_F_CHKFAIL].type || - stats[ST_F_CHECK_HEALTH].u.u32 == stats[ST_F_CHECK_RISE].u.u32 + stats[ST_F_CHECK_FALL].u.u32 - 1) { + else if (!stats[ST_I_PX_CHKFAIL].type || + stats[ST_I_PX_CHECK_HEALTH].u.u32 == stats[ST_I_PX_CHECK_RISE].u.u32 + stats[ST_I_PX_CHECK_FALL].u.u32 - 1) { /* no check or max health = UP */ - if (stats[ST_F_WEIGHT].u.u32) + if (stats[ST_I_PX_WEIGHT].u.u32) style = "up"; else style = "draining"; @@ -822,45 +822,45 @@ int stats_dump_fields_html(struct buffer *out, style = "going_down"; } - if (strncmp(field_str(stats, ST_F_STATUS), "MAINT", 5) == 0) + if (strncmp(field_str(stats, ST_I_PX_STATUS), "MAINT", 5) == 0) chunk_appendf(out, ""); else chunk_appendf(out, "", - (stats[ST_F_BCK].u.u32) ? "backup" : "active", style); + (stats[ST_I_PX_BCK].u.u32) ? "backup" : "active", style); if (flags & STAT_ADMIN) chunk_appendf(out, "", - field_str(stats, ST_F_PXNAME), - field_str(stats, ST_F_SVNAME)); + field_str(stats, ST_I_PX_PXNAME), + field_str(stats, ST_I_PX_SVNAME)); chunk_appendf(out, "%s" "%s" "", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), + field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), (flags & STAT_SHLGNDS) ? "" : "", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), field_str(stats, ST_F_SVNAME)); + field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), field_str(stats, ST_I_PX_SVNAME)); if (flags & STAT_SHLGNDS) { chunk_appendf(out, "
"); - if (isdigit((unsigned char)*field_str(stats, ST_F_ADDR))) - chunk_appendf(out, "IPv4: %s, ", field_str(stats, ST_F_ADDR)); - else if (*field_str(stats, ST_F_ADDR) == '[') - chunk_appendf(out, "IPv6: %s, ", field_str(stats, ST_F_ADDR)); - else if (*field_str(stats, ST_F_ADDR)) - chunk_appendf(out, "%s, ", field_str(stats, ST_F_ADDR)); + if (isdigit((unsigned char)*field_str(stats, ST_I_PX_ADDR))) + chunk_appendf(out, "IPv4: %s, ", field_str(stats, ST_I_PX_ADDR)); + else if (*field_str(stats, ST_I_PX_ADDR) == '[') + chunk_appendf(out, "IPv6: %s, ", field_str(stats, ST_I_PX_ADDR)); + else if (*field_str(stats, ST_I_PX_ADDR)) + chunk_appendf(out, "%s, ", field_str(stats, ST_I_PX_ADDR)); /* id */ - chunk_appendf(out, "id: %d, rid: %d", stats[ST_F_SID].u.u32, stats[ST_F_SRID].u.u32); + chunk_appendf(out, "id: %d, rid: %d", stats[ST_I_PX_SID].u.u32, stats[ST_I_PX_SRID].u.u32); /* cookie */ - if (stats[ST_F_COOKIE].type) { + if (stats[ST_I_PX_COOKIE].type) { chunk_appendf(out, ", cookie: '"); - chunk_initstr(&src, field_str(stats, ST_F_COOKIE)); + chunk_initstr(&src, field_str(stats, ST_I_PX_COOKIE)); chunk_htmlencode(out, &src); chunk_appendf(out, "'"); } @@ -875,8 +875,8 @@ int stats_dump_fields_html(struct buffer *out, "%s%s" "", (flags & STAT_SHLGNDS) ? "" : "", - U2H(stats[ST_F_QCUR].u.u32), U2H(stats[ST_F_QMAX].u.u32), LIM2A(stats[ST_F_QLIMIT].u.u32, "-"), - U2H(stats[ST_F_RATE].u.u32), U2H(stats[ST_F_RATE_MAX].u.u32)); + U2H(stats[ST_I_PX_QCUR].u.u32), U2H(stats[ST_I_PX_QMAX].u.u32), LIM2A(stats[ST_I_PX_QLIMIT].u.u32, "-"), + U2H(stats[ST_I_PX_RATE].u.u32), U2H(stats[ST_I_PX_RATE_MAX].u.u32)); chunk_appendf(out, /* sessions: current, max, limit, total */ @@ -895,22 +895,22 @@ int stats_dump_fields_html(struct buffer *out, "%s
" "" "", - U2H(stats[ST_F_SCUR].u.u32), - U2H(stats[ST_F_SCUR].u.u32), - U2H(stats[ST_F_USED_CONN_CUR].u.u32), - U2H(stats[ST_F_SRV_ICUR].u.u32), - U2H(stats[ST_F_IDLE_CONN_CUR].u.u32), - U2H(stats[ST_F_SAFE_CONN_CUR].u.u32), - U2H(stats[ST_F_NEED_CONN_EST].u.u32), + U2H(stats[ST_I_PX_SCUR].u.u32), + U2H(stats[ST_I_PX_SCUR].u.u32), + U2H(stats[ST_I_PX_USED_CONN_CUR].u.u32), + U2H(stats[ST_I_PX_SRV_ICUR].u.u32), + U2H(stats[ST_I_PX_IDLE_CONN_CUR].u.u32), + U2H(stats[ST_I_PX_SAFE_CONN_CUR].u.u32), + U2H(stats[ST_I_PX_NEED_CONN_EST].u.u32), - LIM2A(stats[ST_F_SLIM].u.u32, "-"), - stats[ST_F_SRV_ILIM].type ? U2H(stats[ST_F_SRV_ILIM].u.u32) : "-", - U2H(stats[ST_F_SMAX].u.u32), LIM2A(stats[ST_F_SLIM].u.u32, "-"), - U2H(stats[ST_F_STOT].u.u64), - U2H(stats[ST_F_STOT].u.u64)); + LIM2A(stats[ST_I_PX_SLIM].u.u32, "-"), + stats[ST_I_PX_SRV_ILIM].type ? U2H(stats[ST_I_PX_SRV_ILIM].u.u32) : "-", + U2H(stats[ST_I_PX_SMAX].u.u32), LIM2A(stats[ST_I_PX_SLIM].u.u32, "-"), + U2H(stats[ST_I_PX_STOT].u.u64), + U2H(stats[ST_I_PX_STOT].u.u64)); /* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */ - if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) { + if (strcmp(field_str(stats, ST_I_PX_MODE), "http") == 0) { chunk_appendf(out, "" "" @@ -924,44 +924,44 @@ int stats_dump_fields_html(struct buffer *out, "" "" "", - U2H(stats[ST_F_CONNECT].u.u64), - U2H(stats[ST_F_REUSE].u.u64), - (stats[ST_F_CONNECT].u.u64 + stats[ST_F_REUSE].u.u64) ? - (int)(100 * stats[ST_F_REUSE].u.u64 / (stats[ST_F_CONNECT].u.u64 + stats[ST_F_REUSE].u.u64)) : 0, - U2H(stats[ST_F_REQ_TOT].u.u64), - U2H(stats[ST_F_HRSP_1XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ? - (int)(100 * stats[ST_F_HRSP_1XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0, - U2H(stats[ST_F_HRSP_2XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ? - (int)(100 * stats[ST_F_HRSP_2XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0, - U2H(stats[ST_F_HRSP_3XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ? - (int)(100 * stats[ST_F_HRSP_3XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0, - U2H(stats[ST_F_HRSP_4XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ? - (int)(100 * stats[ST_F_HRSP_4XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0, - U2H(stats[ST_F_HRSP_5XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ? - (int)(100 * stats[ST_F_HRSP_5XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0, - U2H(stats[ST_F_HRSP_OTHER].u.u64), stats[ST_F_REQ_TOT].u.u64 ? - (int)(100 * stats[ST_F_HRSP_OTHER].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0, - U2H(stats[ST_F_WREW].u.u64), - U2H(stats[ST_F_EINT].u.u64)); + U2H(stats[ST_I_PX_CONNECT].u.u64), + U2H(stats[ST_I_PX_REUSE].u.u64), + (stats[ST_I_PX_CONNECT].u.u64 + stats[ST_I_PX_REUSE].u.u64) ? + (int)(100 * stats[ST_I_PX_REUSE].u.u64 / (stats[ST_I_PX_CONNECT].u.u64 + stats[ST_I_PX_REUSE].u.u64)) : 0, + U2H(stats[ST_I_PX_REQ_TOT].u.u64), + U2H(stats[ST_I_PX_HRSP_1XX].u.u64), stats[ST_I_PX_REQ_TOT].u.u64 ? + (int)(100 * stats[ST_I_PX_HRSP_1XX].u.u64 / stats[ST_I_PX_REQ_TOT].u.u64) : 0, + U2H(stats[ST_I_PX_HRSP_2XX].u.u64), stats[ST_I_PX_REQ_TOT].u.u64 ? + (int)(100 * stats[ST_I_PX_HRSP_2XX].u.u64 / stats[ST_I_PX_REQ_TOT].u.u64) : 0, + U2H(stats[ST_I_PX_HRSP_3XX].u.u64), stats[ST_I_PX_REQ_TOT].u.u64 ? + (int)(100 * stats[ST_I_PX_HRSP_3XX].u.u64 / stats[ST_I_PX_REQ_TOT].u.u64) : 0, + U2H(stats[ST_I_PX_HRSP_4XX].u.u64), stats[ST_I_PX_REQ_TOT].u.u64 ? + (int)(100 * stats[ST_I_PX_HRSP_4XX].u.u64 / stats[ST_I_PX_REQ_TOT].u.u64) : 0, + U2H(stats[ST_I_PX_HRSP_5XX].u.u64), stats[ST_I_PX_REQ_TOT].u.u64 ? + (int)(100 * stats[ST_I_PX_HRSP_5XX].u.u64 / stats[ST_I_PX_REQ_TOT].u.u64) : 0, + U2H(stats[ST_I_PX_HRSP_OTHER].u.u64), stats[ST_I_PX_REQ_TOT].u.u64 ? + (int)(100 * stats[ST_I_PX_HRSP_OTHER].u.u64 / stats[ST_I_PX_REQ_TOT].u.u64) : 0, + U2H(stats[ST_I_PX_WREW].u.u64), + U2H(stats[ST_I_PX_EINT].u.u64)); } chunk_appendf(out, ""); chunk_appendf(out, "", - U2H(stats[ST_F_QT_MAX].u.u32), U2H(stats[ST_F_QTIME].u.u32)); + U2H(stats[ST_I_PX_QT_MAX].u.u32), U2H(stats[ST_I_PX_QTIME].u.u32)); chunk_appendf(out, "", - U2H(stats[ST_F_CT_MAX].u.u32), U2H(stats[ST_F_CTIME].u.u32)); - if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) + U2H(stats[ST_I_PX_CT_MAX].u.u32), U2H(stats[ST_I_PX_CTIME].u.u32)); + if (strcmp(field_str(stats, ST_I_PX_MODE), "http") == 0) chunk_appendf(out, "", - U2H(stats[ST_F_RT_MAX].u.u32), U2H(stats[ST_F_RTIME].u.u32)); + U2H(stats[ST_I_PX_RT_MAX].u.u32), U2H(stats[ST_I_PX_RTIME].u.u32)); chunk_appendf(out, "", - U2H(stats[ST_F_TT_MAX].u.u32), U2H(stats[ST_F_TTIME].u.u32)); + U2H(stats[ST_I_PX_TT_MAX].u.u32), U2H(stats[ST_I_PX_TTIME].u.u32)); chunk_appendf(out, "
Cum. sessions:%s
New connections:%s
Reused connections:%s(%d%%)
Failed hdr rewrites:%s
Internal error:%s
Max / Avg over last 1024 success. conn.
- Queue time:%s / %sms
- Connect time:%s / %sms
- Responses time:%s / %sms
- Total time:%s / %sms
" /* sessions: lbtot, last */ "%s%s", - U2H(stats[ST_F_LBTOT].u.u64), - human_time(stats[ST_F_LASTSESS].u.s32, 1)); + U2H(stats[ST_I_PX_LBTOT].u.u64), + human_time(stats[ST_I_PX_LASTSESS].u.s32, 1)); chunk_appendf(out, /* bytes : in, out */ @@ -975,14 +975,14 @@ int stats_dump_fields_html(struct buffer *out, /* warnings: retries, redispatches */ "%lld%lld" "", - U2H(stats[ST_F_BIN].u.u64), U2H(stats[ST_F_BOUT].u.u64), - U2H(stats[ST_F_DRESP].u.u64), - U2H(stats[ST_F_ECON].u.u64), - U2H(stats[ST_F_ERESP].u.u64), - (long long)stats[ST_F_CLI_ABRT].u.u64, - (long long)stats[ST_F_SRV_ABRT].u.u64, - (long long)stats[ST_F_WRETR].u.u64, - (long long)stats[ST_F_WREDIS].u.u64); + U2H(stats[ST_I_PX_BIN].u.u64), U2H(stats[ST_I_PX_BOUT].u.u64), + U2H(stats[ST_I_PX_DRESP].u.u64), + U2H(stats[ST_I_PX_ECON].u.u64), + U2H(stats[ST_I_PX_ERESP].u.u64), + (long long)stats[ST_I_PX_CLI_ABRT].u.u64, + (long long)stats[ST_I_PX_SRV_ABRT].u.u64, + (long long)stats[ST_I_PX_WRETR].u.u64, + (long long)stats[ST_I_PX_WREDIS].u.u64); /* status, last change */ chunk_appendf(out, ""); @@ -994,59 +994,59 @@ int stats_dump_fields_html(struct buffer *out, */ - if (strncmp(field_str(stats, ST_F_STATUS), "MAINT", 5) == 0) { - chunk_appendf(out, "%s MAINT", human_time(stats[ST_F_LASTCHG].u.u32, 1)); + if (strncmp(field_str(stats, ST_I_PX_STATUS), "MAINT", 5) == 0) { + chunk_appendf(out, "%s MAINT", human_time(stats[ST_I_PX_LASTCHG].u.u32, 1)); } - else if (strcmp(field_str(stats, ST_F_STATUS), "no check") == 0) { + else if (strcmp(field_str(stats, ST_I_PX_STATUS), "no check") == 0) { chunk_strcat(out, "no check"); } else { - chunk_appendf(out, "%s %s", human_time(stats[ST_F_LASTCHG].u.u32, 1), field_str(stats, ST_F_STATUS)); - if (strncmp(field_str(stats, ST_F_STATUS), "DOWN", 4) == 0) { - if (stats[ST_F_CHECK_HEALTH].u.u32) + chunk_appendf(out, "%s %s", human_time(stats[ST_I_PX_LASTCHG].u.u32, 1), field_str(stats, ST_I_PX_STATUS)); + if (strncmp(field_str(stats, ST_I_PX_STATUS), "DOWN", 4) == 0) { + if (stats[ST_I_PX_CHECK_HEALTH].u.u32) chunk_strcat(out, " ↑"); } - else if (stats[ST_F_CHECK_HEALTH].u.u32 < stats[ST_F_CHECK_RISE].u.u32 + stats[ST_F_CHECK_FALL].u.u32 - 1) + else if (stats[ST_I_PX_CHECK_HEALTH].u.u32 < stats[ST_I_PX_CHECK_RISE].u.u32 + stats[ST_I_PX_CHECK_FALL].u.u32 - 1) chunk_strcat(out, " ↓"); } - if (strncmp(field_str(stats, ST_F_STATUS), "DOWN", 4) == 0 && - stats[ST_F_AGENT_STATUS].type && !stats[ST_F_AGENT_HEALTH].u.u32) { + if (strncmp(field_str(stats, ST_I_PX_STATUS), "DOWN", 4) == 0 && + stats[ST_I_PX_AGENT_STATUS].type && !stats[ST_I_PX_AGENT_HEALTH].u.u32) { chunk_appendf(out, " %s", - field_str(stats, ST_F_AGENT_STATUS)); + field_str(stats, ST_I_PX_AGENT_STATUS)); - if (stats[ST_F_AGENT_CODE].type) - chunk_appendf(out, "/%d", stats[ST_F_AGENT_CODE].u.u32); + if (stats[ST_I_PX_AGENT_CODE].type) + chunk_appendf(out, "/%d", stats[ST_I_PX_AGENT_CODE].u.u32); - if (stats[ST_F_AGENT_DURATION].type) - chunk_appendf(out, " in %lums", (long)stats[ST_F_AGENT_DURATION].u.u64); + if (stats[ST_I_PX_AGENT_DURATION].type) + chunk_appendf(out, " in %lums", (long)stats[ST_I_PX_AGENT_DURATION].u.u64); - chunk_appendf(out, "
%s", field_str(stats, ST_F_AGENT_DESC)); + chunk_appendf(out, "
%s", field_str(stats, ST_I_PX_AGENT_DESC)); - if (*field_str(stats, ST_F_LAST_AGT)) { + if (*field_str(stats, ST_I_PX_LAST_AGT)) { chunk_appendf(out, ": "); - chunk_initstr(&src, field_str(stats, ST_F_LAST_AGT)); + chunk_initstr(&src, field_str(stats, ST_I_PX_LAST_AGT)); chunk_htmlencode(out, &src); } chunk_appendf(out, "
"); } - else if (stats[ST_F_CHECK_STATUS].type) { + else if (stats[ST_I_PX_CHECK_STATUS].type) { chunk_appendf(out, " %s", - field_str(stats, ST_F_CHECK_STATUS)); + field_str(stats, ST_I_PX_CHECK_STATUS)); - if (stats[ST_F_CHECK_CODE].type) - chunk_appendf(out, "/%d", stats[ST_F_CHECK_CODE].u.u32); + if (stats[ST_I_PX_CHECK_CODE].type) + chunk_appendf(out, "/%d", stats[ST_I_PX_CHECK_CODE].u.u32); - if (stats[ST_F_CHECK_DURATION].type) - chunk_appendf(out, " in %lums", (long)stats[ST_F_CHECK_DURATION].u.u64); + if (stats[ST_I_PX_CHECK_DURATION].type) + chunk_appendf(out, " in %lums", (long)stats[ST_I_PX_CHECK_DURATION].u.u64); - chunk_appendf(out, "
%s", field_str(stats, ST_F_CHECK_DESC)); + chunk_appendf(out, "
%s", field_str(stats, ST_I_PX_CHECK_DESC)); - if (*field_str(stats, ST_F_LAST_CHK)) { + if (*field_str(stats, ST_I_PX_LAST_CHK)) { chunk_appendf(out, ": "); - chunk_initstr(&src, field_str(stats, ST_F_LAST_CHK)); + chunk_initstr(&src, field_str(stats, ST_I_PX_LAST_CHK)); chunk_htmlencode(out, &src); } chunk_appendf(out, "
"); @@ -1060,39 +1060,39 @@ int stats_dump_fields_html(struct buffer *out, /* act, bck */ "%s%s" "", - stats[ST_F_WEIGHT].u.u32, stats[ST_F_UWEIGHT].u.u32, - stats[ST_F_BCK].u.u32 ? "-" : "Y", - stats[ST_F_BCK].u.u32 ? "Y" : "-"); + stats[ST_I_PX_WEIGHT].u.u32, stats[ST_I_PX_UWEIGHT].u.u32, + stats[ST_I_PX_BCK].u.u32 ? "-" : "Y", + stats[ST_I_PX_BCK].u.u32 ? "Y" : "-"); /* check failures: unique, fatal, down time */ - if (strcmp(field_str(stats, ST_F_STATUS), "MAINT (resolution)") == 0) { + if (strcmp(field_str(stats, ST_I_PX_STATUS), "MAINT (resolution)") == 0) { chunk_appendf(out, "resolution"); } - else if (stats[ST_F_CHKFAIL].type) { - chunk_appendf(out, "%lld", (long long)stats[ST_F_CHKFAIL].u.u64); + else if (stats[ST_I_PX_CHKFAIL].type) { + chunk_appendf(out, "%lld", (long long)stats[ST_I_PX_CHKFAIL].u.u64); - if (stats[ST_F_HANAFAIL].type) - chunk_appendf(out, "/%lld", (long long)stats[ST_F_HANAFAIL].u.u64); + if (stats[ST_I_PX_HANAFAIL].type) + chunk_appendf(out, "/%lld", (long long)stats[ST_I_PX_HANAFAIL].u.u64); chunk_appendf(out, "
Failed Health Checks%s
" "%lld%s" "", - stats[ST_F_HANAFAIL].type ? "/Health Analyses" : "", - (long long)stats[ST_F_CHKDOWN].u.u64, human_time(stats[ST_F_DOWNTIME].u.u32, 1)); + stats[ST_I_PX_HANAFAIL].type ? "/Health Analyses" : "", + (long long)stats[ST_I_PX_CHKDOWN].u.u64, human_time(stats[ST_I_PX_DOWNTIME].u.u32, 1)); } - else if (strcmp(field_str(stats, ST_F_STATUS), "MAINT") != 0 && field_format(stats, ST_F_TRACKED) == FF_STR) { + else if (strcmp(field_str(stats, ST_I_PX_STATUS), "MAINT") != 0 && field_format(stats, ST_I_PX_TRACKED) == FF_STR) { /* tracking a server (hence inherited maint would appear as "MAINT (via...)" */ chunk_appendf(out, "via %s", - field_str(stats, ST_F_TRACKED), field_str(stats, ST_F_TRACKED)); + field_str(stats, ST_I_PX_TRACKED), field_str(stats, ST_I_PX_TRACKED)); } else chunk_appendf(out, ""); /* throttle */ - if (stats[ST_F_THROTTLE].type) - chunk_appendf(out, "%d %%\n", stats[ST_F_THROTTLE].u.u32); + if (stats[ST_I_PX_THROTTLE].type) + chunk_appendf(out, "%d %%\n", stats[ST_I_PX_THROTTLE].u.u32); else chunk_appendf(out, "-"); @@ -1107,7 +1107,7 @@ int stats_dump_fields_html(struct buffer *out, for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "%s%s", - mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); + mod->stats[j].desc, field_to_html_str(&stats[ST_I_PX_MAX + i])); ++i; } chunk_appendf(out, "
"); @@ -1121,7 +1121,7 @@ int stats_dump_fields_html(struct buffer *out, chunk_appendf(out, "\n"); } - else if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_BE) { + else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_BE) { chunk_appendf(out, ""); if (flags & STAT_ADMIN) { /* Column sub-heading for Enable or Disable server */ @@ -1134,17 +1134,17 @@ int stats_dump_fields_html(struct buffer *out, "Backend" "", (flags & STAT_SHLGNDS)?"":"", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_PXNAME)); + field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_PXNAME)); if (flags & STAT_SHLGNDS) { /* balancing */ chunk_appendf(out, "
balancing: %s", - field_str(stats, ST_F_ALGO)); + field_str(stats, ST_I_PX_ALGO)); /* cookie */ - if (stats[ST_F_COOKIE].type) { + if (stats[ST_I_PX_COOKIE].type) { chunk_appendf(out, ", cookie: '"); - chunk_initstr(&src, field_str(stats, ST_F_COOKIE)); + chunk_initstr(&src, field_str(stats, ST_I_PX_COOKIE)); chunk_htmlencode(out, &src); chunk_appendf(out, "'"); } @@ -1159,8 +1159,8 @@ int stats_dump_fields_html(struct buffer *out, "%s%s" "", (flags & STAT_SHLGNDS)?"":"", - U2H(stats[ST_F_QCUR].u.u32), U2H(stats[ST_F_QMAX].u.u32), - U2H(stats[ST_F_RATE].u.u32), U2H(stats[ST_F_RATE_MAX].u.u32)); + U2H(stats[ST_I_PX_QCUR].u.u32), U2H(stats[ST_I_PX_QMAX].u.u32), + U2H(stats[ST_I_PX_RATE].u.u32), U2H(stats[ST_I_PX_RATE_MAX].u.u32)); chunk_appendf(out, /* sessions: current, max, limit, total */ @@ -1168,12 +1168,12 @@ int stats_dump_fields_html(struct buffer *out, "%s
" "" "", - U2H(stats[ST_F_SCUR].u.u32), U2H(stats[ST_F_SMAX].u.u32), U2H(stats[ST_F_SLIM].u.u32), - U2H(stats[ST_F_STOT].u.u64), - U2H(stats[ST_F_STOT].u.u64)); + U2H(stats[ST_I_PX_SCUR].u.u32), U2H(stats[ST_I_PX_SMAX].u.u32), U2H(stats[ST_I_PX_SLIM].u.u32), + U2H(stats[ST_I_PX_STOT].u.u64), + U2H(stats[ST_I_PX_STOT].u.u64)); /* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */ - if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) { + if (strcmp(field_str(stats, ST_I_PX_MODE), "http") == 0) { chunk_appendf(out, "" "" @@ -1190,38 +1190,38 @@ int stats_dump_fields_html(struct buffer *out, "" "" "", - U2H(stats[ST_F_CONNECT].u.u64), - U2H(stats[ST_F_REUSE].u.u64), - (stats[ST_F_CONNECT].u.u64 + stats[ST_F_REUSE].u.u64) ? - (int)(100 * stats[ST_F_REUSE].u.u64 / (stats[ST_F_CONNECT].u.u64 + stats[ST_F_REUSE].u.u64)) : 0, - U2H(stats[ST_F_REQ_TOT].u.u64), - U2H(stats[ST_F_HRSP_1XX].u.u64), - U2H(stats[ST_F_HRSP_2XX].u.u64), - U2H(stats[ST_F_COMP_RSP].u.u64), - stats[ST_F_HRSP_2XX].u.u64 ? - (int)(100 * stats[ST_F_COMP_RSP].u.u64 / stats[ST_F_HRSP_2XX].u.u64) : 0, - U2H(stats[ST_F_HRSP_3XX].u.u64), - U2H(stats[ST_F_HRSP_4XX].u.u64), - U2H(stats[ST_F_HRSP_5XX].u.u64), - U2H(stats[ST_F_HRSP_OTHER].u.u64), - U2H(stats[ST_F_CACHE_LOOKUPS].u.u64), - U2H(stats[ST_F_CACHE_HITS].u.u64), - stats[ST_F_CACHE_LOOKUPS].u.u64 ? - (int)(100 * stats[ST_F_CACHE_HITS].u.u64 / stats[ST_F_CACHE_LOOKUPS].u.u64) : 0, - U2H(stats[ST_F_WREW].u.u64), - U2H(stats[ST_F_EINT].u.u64)); + U2H(stats[ST_I_PX_CONNECT].u.u64), + U2H(stats[ST_I_PX_REUSE].u.u64), + (stats[ST_I_PX_CONNECT].u.u64 + stats[ST_I_PX_REUSE].u.u64) ? + (int)(100 * stats[ST_I_PX_REUSE].u.u64 / (stats[ST_I_PX_CONNECT].u.u64 + stats[ST_I_PX_REUSE].u.u64)) : 0, + U2H(stats[ST_I_PX_REQ_TOT].u.u64), + U2H(stats[ST_I_PX_HRSP_1XX].u.u64), + U2H(stats[ST_I_PX_HRSP_2XX].u.u64), + U2H(stats[ST_I_PX_COMP_RSP].u.u64), + stats[ST_I_PX_HRSP_2XX].u.u64 ? + (int)(100 * stats[ST_I_PX_COMP_RSP].u.u64 / stats[ST_I_PX_HRSP_2XX].u.u64) : 0, + U2H(stats[ST_I_PX_HRSP_3XX].u.u64), + U2H(stats[ST_I_PX_HRSP_4XX].u.u64), + U2H(stats[ST_I_PX_HRSP_5XX].u.u64), + U2H(stats[ST_I_PX_HRSP_OTHER].u.u64), + U2H(stats[ST_I_PX_CACHE_LOOKUPS].u.u64), + U2H(stats[ST_I_PX_CACHE_HITS].u.u64), + stats[ST_I_PX_CACHE_LOOKUPS].u.u64 ? + (int)(100 * stats[ST_I_PX_CACHE_HITS].u.u64 / stats[ST_I_PX_CACHE_LOOKUPS].u.u64) : 0, + U2H(stats[ST_I_PX_WREW].u.u64), + U2H(stats[ST_I_PX_EINT].u.u64)); } chunk_appendf(out, ""); chunk_appendf(out, "", - U2H(stats[ST_F_QT_MAX].u.u32), U2H(stats[ST_F_QTIME].u.u32)); + U2H(stats[ST_I_PX_QT_MAX].u.u32), U2H(stats[ST_I_PX_QTIME].u.u32)); chunk_appendf(out, "", - U2H(stats[ST_F_CT_MAX].u.u32), U2H(stats[ST_F_CTIME].u.u32)); - if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) + U2H(stats[ST_I_PX_CT_MAX].u.u32), U2H(stats[ST_I_PX_CTIME].u.u32)); + if (strcmp(field_str(stats, ST_I_PX_MODE), "http") == 0) chunk_appendf(out, "", - U2H(stats[ST_F_RT_MAX].u.u32), U2H(stats[ST_F_RTIME].u.u32)); + U2H(stats[ST_I_PX_RT_MAX].u.u32), U2H(stats[ST_I_PX_RTIME].u.u32)); chunk_appendf(out, "", - U2H(stats[ST_F_TT_MAX].u.u32), U2H(stats[ST_F_TTIME].u.u32)); + U2H(stats[ST_I_PX_TT_MAX].u.u32), U2H(stats[ST_I_PX_TTIME].u.u32)); chunk_appendf(out, "
Cum. sessions:%s
New connections:%s
Reused connections:%s(%d%%)
Failed hdr rewrites:%s
Internal errors:%s
Max / Avg over last 1024 success. conn.
- Queue time:%s / %sms
- Connect time:%s / %sms
- Responses time:%s / %sms
- Total time:%s / %sms
" @@ -1230,9 +1230,9 @@ int stats_dump_fields_html(struct buffer *out, /* bytes: in */ "%s" "", - U2H(stats[ST_F_LBTOT].u.u64), - human_time(stats[ST_F_LASTSESS].u.s32, 1), - U2H(stats[ST_F_BIN].u.u64)); + U2H(stats[ST_I_PX_LBTOT].u.u64), + human_time(stats[ST_I_PX_LASTSESS].u.s32, 1), + U2H(stats[ST_I_PX_BIN].u.u64)); chunk_appendf(out, /* bytes:out + compression stats (via hover): comp_in, comp_out, comp_byp */ @@ -1243,16 +1243,16 @@ int stats_dump_fields_html(struct buffer *out, "Compression bypass:%s" "Total bytes saved:%s(%d%%)" "
%s", - (stats[ST_F_COMP_IN].u.u64 || stats[ST_F_COMP_BYP].u.u64) ? "":"", - U2H(stats[ST_F_BOUT].u.u64), - U2H(stats[ST_F_BOUT].u.u64), - U2H(stats[ST_F_COMP_IN].u.u64), - U2H(stats[ST_F_COMP_OUT].u.u64), - stats[ST_F_COMP_IN].u.u64 ? (int)(stats[ST_F_COMP_OUT].u.u64 * 100 / stats[ST_F_COMP_IN].u.u64) : 0, - U2H(stats[ST_F_COMP_BYP].u.u64), - U2H(stats[ST_F_COMP_IN].u.u64 - stats[ST_F_COMP_OUT].u.u64), - stats[ST_F_BOUT].u.u64 ? (int)((stats[ST_F_COMP_IN].u.u64 - stats[ST_F_COMP_OUT].u.u64) * 100 / stats[ST_F_BOUT].u.u64) : 0, - (stats[ST_F_COMP_IN].u.u64 || stats[ST_F_COMP_BYP].u.u64) ? "":""); + (stats[ST_I_PX_COMP_IN].u.u64 || stats[ST_I_PX_COMP_BYP].u.u64) ? "":"", + U2H(stats[ST_I_PX_BOUT].u.u64), + U2H(stats[ST_I_PX_BOUT].u.u64), + U2H(stats[ST_I_PX_COMP_IN].u.u64), + U2H(stats[ST_I_PX_COMP_OUT].u.u64), + stats[ST_I_PX_COMP_IN].u.u64 ? (int)(stats[ST_I_PX_COMP_OUT].u.u64 * 100 / stats[ST_I_PX_COMP_IN].u.u64) : 0, + U2H(stats[ST_I_PX_COMP_BYP].u.u64), + U2H(stats[ST_I_PX_COMP_IN].u.u64 - stats[ST_I_PX_COMP_OUT].u.u64), + stats[ST_I_PX_BOUT].u.u64 ? (int)((stats[ST_I_PX_COMP_IN].u.u64 - stats[ST_I_PX_COMP_OUT].u.u64) * 100 / stats[ST_I_PX_BOUT].u.u64) : 0, + (stats[ST_I_PX_COMP_IN].u.u64 || stats[ST_I_PX_COMP_BYP].u.u64) ? "":""); chunk_appendf(out, /* denied: req, resp */ @@ -1270,24 +1270,24 @@ int stats_dump_fields_html(struct buffer *out, "%s %s %d/%d" "%d%d" "", - U2H(stats[ST_F_DREQ].u.u64), U2H(stats[ST_F_DRESP].u.u64), - U2H(stats[ST_F_ECON].u.u64), - U2H(stats[ST_F_ERESP].u.u64), - (long long)stats[ST_F_CLI_ABRT].u.u64, - (long long)stats[ST_F_SRV_ABRT].u.u64, - (long long)stats[ST_F_WRETR].u.u64, (long long)stats[ST_F_WREDIS].u.u64, - human_time(stats[ST_F_LASTCHG].u.u32, 1), - strcmp(field_str(stats, ST_F_STATUS), "DOWN") ? field_str(stats, ST_F_STATUS) : "DOWN", - stats[ST_F_WEIGHT].u.u32, stats[ST_F_UWEIGHT].u.u32, - stats[ST_F_ACT].u.u32, stats[ST_F_BCK].u.u32); + U2H(stats[ST_I_PX_DREQ].u.u64), U2H(stats[ST_I_PX_DRESP].u.u64), + U2H(stats[ST_I_PX_ECON].u.u64), + U2H(stats[ST_I_PX_ERESP].u.u64), + (long long)stats[ST_I_PX_CLI_ABRT].u.u64, + (long long)stats[ST_I_PX_SRV_ABRT].u.u64, + (long long)stats[ST_I_PX_WRETR].u.u64, (long long)stats[ST_I_PX_WREDIS].u.u64, + human_time(stats[ST_I_PX_LASTCHG].u.u32, 1), + strcmp(field_str(stats, ST_I_PX_STATUS), "DOWN") ? field_str(stats, ST_I_PX_STATUS) : "DOWN", + stats[ST_I_PX_WEIGHT].u.u32, stats[ST_I_PX_UWEIGHT].u.u32, + stats[ST_I_PX_ACT].u.u32, stats[ST_I_PX_BCK].u.u32); chunk_appendf(out, /* rest of backend: nothing, down transitions, total downtime, throttle */ " %d" "%s" "", - stats[ST_F_CHKDOWN].u.u32, - stats[ST_F_DOWNTIME].type ? human_time(stats[ST_F_DOWNTIME].u.u32, 1) : " "); + stats[ST_I_PX_CHKDOWN].u.u32, + stats[ST_I_PX_DOWNTIME].type ? human_time(stats[ST_I_PX_DOWNTIME].u.u32, 1) : " "); if (flags & STAT_SHMODULES) { list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { @@ -1300,7 +1300,7 @@ int stats_dump_fields_html(struct buffer *out, for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "%s%s", - mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); + mod->stats[j].desc, field_to_html_str(&stats[ST_I_PX_MAX + i])); ++i; } chunk_appendf(out, "
"); diff --git a/src/stats-json.c b/src/stats-json.c index 454e01871..290a32ec3 100644 --- a/src/stats-json.c +++ b/src/stats-json.c @@ -191,10 +191,10 @@ int stats_dump_fields_json(struct buffer *out, stats_print_proxy_field_json(out, &stats[field], stat_f[domain][field].name, field, - stats[ST_F_TYPE].u.u32, - stats[ST_F_IID].u.u32, - stats[ST_F_SID].u.u32, - stats[ST_F_PID].u.u32); + stats[ST_I_PX_TYPE].u.u32, + stats[ST_I_PX_IID].u.u32, + stats[ST_I_PX_SID].u.u32, + stats[ST_I_PX_PID].u.u32); } else if (domain == STATS_DOMAIN_RESOLVERS) { stats_print_rslv_field_json(out, &stats[field], stat_f[domain][field].name, diff --git a/src/stats.c b/src/stats.c index 5d7dc1a95..7eba03f18 100644 --- a/src/stats.c +++ b/src/stats.c @@ -164,132 +164,132 @@ const struct name_desc info_fields[INF_TOTAL_FIELDS] = { [INF_NICED_TASKS] = { .name = "Niced_tasks", .desc = "Total number of active tasks+tasklets in the current worker process (Run_queue) that are niced" }, }; -const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = { - [ST_F_PXNAME] = { .name = "pxname", .desc = "Proxy name" }, - [ST_F_SVNAME] = { .name = "svname", .desc = "Server name" }, - [ST_F_QCUR] = { .name = "qcur", .desc = "Number of current queued connections" }, - [ST_F_QMAX] = { .name = "qmax", .desc = "Highest value of queued connections encountered since process started" }, - [ST_F_SCUR] = { .name = "scur", .desc = "Number of current sessions on the frontend, backend or server" }, - [ST_F_SMAX] = { .name = "smax", .desc = "Highest value of current sessions encountered since process started" }, - [ST_F_SLIM] = { .name = "slim", .desc = "Frontend/listener/server's maxconn, backend's fullconn" }, - [ST_F_STOT] = { .name = "stot", .desc = "Total number of sessions since process started" }, - [ST_F_BIN] = { .name = "bin", .desc = "Total number of request bytes since process started" }, - [ST_F_BOUT] = { .name = "bout", .desc = "Total number of response bytes since process started" }, - [ST_F_DREQ] = { .name = "dreq", .desc = "Total number of denied requests since process started" }, - [ST_F_DRESP] = { .name = "dresp", .desc = "Total number of denied responses since process started" }, - [ST_F_EREQ] = { .name = "ereq", .desc = "Total number of invalid requests since process started" }, - [ST_F_ECON] = { .name = "econ", .desc = "Total number of failed connections to server since the worker process started" }, - [ST_F_ERESP] = { .name = "eresp", .desc = "Total number of invalid responses since the worker process started" }, - [ST_F_WRETR] = { .name = "wretr", .desc = "Total number of server connection retries since the worker process started" }, - [ST_F_WREDIS] = { .name = "wredis", .desc = "Total number of server redispatches due to connection failures since the worker process started" }, - [ST_F_STATUS] = { .name = "status", .desc = "Frontend/listen status: OPEN/WAITING/FULL/STOP; backend: UP/DOWN; server: last check status" }, - [ST_F_WEIGHT] = { .name = "weight", .desc = "Server's effective weight, or sum of active servers' effective weights for a backend" }, - [ST_F_ACT] = { .name = "act", .desc = "Total number of active UP servers with a non-zero weight" }, - [ST_F_BCK] = { .name = "bck", .desc = "Total number of backup UP servers with a non-zero weight" }, - [ST_F_CHKFAIL] = { .name = "chkfail", .desc = "Total number of failed individual health checks per server/backend, since the worker process started" }, - [ST_F_CHKDOWN] = { .name = "chkdown", .desc = "Total number of failed checks causing UP to DOWN server transitions, per server/backend, since the worker process started" }, - [ST_F_LASTCHG] = { .name = "lastchg", .desc = "How long ago the last server state changed, in seconds" }, - [ST_F_DOWNTIME] = { .name = "downtime", .desc = "Total time spent in DOWN state, for server or backend" }, - [ST_F_QLIMIT] = { .name = "qlimit", .desc = "Limit on the number of connections in queue, for servers only (maxqueue argument)" }, - [ST_F_PID] = { .name = "pid", .desc = "Relative worker process number (1)" }, - [ST_F_IID] = { .name = "iid", .desc = "Frontend or Backend numeric identifier ('id' setting)" }, - [ST_F_SID] = { .name = "sid", .desc = "Server numeric identifier ('id' setting)" }, - [ST_F_THROTTLE] = { .name = "throttle", .desc = "Throttling ratio applied to a server's maxconn and weight during the slowstart period (0 to 100%)" }, - [ST_F_LBTOT] = { .name = "lbtot", .desc = "Total number of requests routed by load balancing since the worker process started (ignores queue pop and stickiness)" }, - [ST_F_TRACKED] = { .name = "tracked", .desc = "Name of the other server this server tracks for its state" }, - [ST_F_TYPE] = { .name = "type", .desc = "Type of the object (Listener, Frontend, Backend, Server)" }, - [ST_F_RATE] = { .name = "rate", .desc = "Total number of sessions processed by this object over the last second (sessions for listeners/frontends, requests for backends/servers)" }, - [ST_F_RATE_LIM] = { .name = "rate_lim", .desc = "Limit on the number of sessions accepted in a second (frontend only, 'rate-limit sessions' setting)" }, - [ST_F_RATE_MAX] = { .name = "rate_max", .desc = "Highest value of sessions per second observed since the worker process started" }, - [ST_F_CHECK_STATUS] = { .name = "check_status", .desc = "Status report of the server's latest health check, prefixed with '*' if a check is currently in progress" }, - [ST_F_CHECK_CODE] = { .name = "check_code", .desc = "HTTP/SMTP/LDAP status code reported by the latest server health check" }, - [ST_F_CHECK_DURATION] = { .name = "check_duration", .desc = "Total duration of the latest server health check, in milliseconds" }, - [ST_F_HRSP_1XX] = { .name = "hrsp_1xx", .desc = "Total number of HTTP responses with status 100-199 returned by this object since the worker process started" }, - [ST_F_HRSP_2XX] = { .name = "hrsp_2xx", .desc = "Total number of HTTP responses with status 200-299 returned by this object since the worker process started" }, - [ST_F_HRSP_3XX] = { .name = "hrsp_3xx", .desc = "Total number of HTTP responses with status 300-399 returned by this object since the worker process started" }, - [ST_F_HRSP_4XX] = { .name = "hrsp_4xx", .desc = "Total number of HTTP responses with status 400-499 returned by this object since the worker process started" }, - [ST_F_HRSP_5XX] = { .name = "hrsp_5xx", .desc = "Total number of HTTP responses with status 500-599 returned by this object since the worker process started" }, - [ST_F_HRSP_OTHER] = { .name = "hrsp_other", .desc = "Total number of HTTP responses with status <100, >599 returned by this object since the worker process started (error -1 included)" }, - [ST_F_HANAFAIL] = { .name = "hanafail", .desc = "Total number of failed checks caused by an 'on-error' directive after an 'observe' condition matched" }, - [ST_F_REQ_RATE] = { .name = "req_rate", .desc = "Number of HTTP requests processed over the last second on this object" }, - [ST_F_REQ_RATE_MAX] = { .name = "req_rate_max", .desc = "Highest value of http requests observed since the worker process started" }, - [ST_F_REQ_TOT] = { .name = "req_tot", .desc = "Total number of HTTP requests processed by this object since the worker process started" }, - [ST_F_CLI_ABRT] = { .name = "cli_abrt", .desc = "Total number of requests or connections aborted by the client since the worker process started" }, - [ST_F_SRV_ABRT] = { .name = "srv_abrt", .desc = "Total number of requests or connections aborted by the server since the worker process started" }, - [ST_F_COMP_IN] = { .name = "comp_in", .desc = "Total number of bytes submitted to the HTTP compressor for this object since the worker process started" }, - [ST_F_COMP_OUT] = { .name = "comp_out", .desc = "Total number of bytes emitted by the HTTP compressor for this object since the worker process started" }, - [ST_F_COMP_BYP] = { .name = "comp_byp", .desc = "Total number of bytes that bypassed HTTP compression for this object since the worker process started (CPU/memory/bandwidth limitation)" }, - [ST_F_COMP_RSP] = { .name = "comp_rsp", .desc = "Total number of HTTP responses that were compressed for this object since the worker process started" }, - [ST_F_LASTSESS] = { .name = "lastsess", .desc = "How long ago some traffic was seen on this object on this worker process, in seconds" }, - [ST_F_LAST_CHK] = { .name = "last_chk", .desc = "Short description of the latest health check report for this server (see also check_desc)" }, - [ST_F_LAST_AGT] = { .name = "last_agt", .desc = "Short description of the latest agent check report for this server (see also agent_desc)" }, - [ST_F_QTIME] = { .name = "qtime", .desc = "Time spent in the queue, in milliseconds, averaged over the 1024 last requests (backend/server)" }, - [ST_F_CTIME] = { .name = "ctime", .desc = "Time spent waiting for a connection to complete, in milliseconds, averaged over the 1024 last requests (backend/server)" }, - [ST_F_RTIME] = { .name = "rtime", .desc = "Time spent waiting for a server response, in milliseconds, averaged over the 1024 last requests (backend/server)" }, - [ST_F_TTIME] = { .name = "ttime", .desc = "Total request+response time (request+queue+connect+response+processing), in milliseconds, averaged over the 1024 last requests (backend/server)" }, - [ST_F_AGENT_STATUS] = { .name = "agent_status", .desc = "Status report of the server's latest agent check, prefixed with '*' if a check is currently in progress" }, - [ST_F_AGENT_CODE] = { .name = "agent_code", .desc = "Status code reported by the latest server agent check" }, - [ST_F_AGENT_DURATION] = { .name = "agent_duration", .desc = "Total duration of the latest server agent check, in milliseconds" }, - [ST_F_CHECK_DESC] = { .name = "check_desc", .desc = "Textual description of the latest health check report for this server" }, - [ST_F_AGENT_DESC] = { .name = "agent_desc", .desc = "Textual description of the latest agent check report for this server" }, - [ST_F_CHECK_RISE] = { .name = "check_rise", .desc = "Number of successful health checks before declaring a server UP (server 'rise' setting)" }, - [ST_F_CHECK_FALL] = { .name = "check_fall", .desc = "Number of failed health checks before declaring a server DOWN (server 'fall' setting)" }, - [ST_F_CHECK_HEALTH] = { .name = "check_health", .desc = "Current server health check level (0..fall-1=DOWN, fall..rise-1=UP)" }, - [ST_F_AGENT_RISE] = { .name = "agent_rise", .desc = "Number of successful agent checks before declaring a server UP (server 'rise' setting)" }, - [ST_F_AGENT_FALL] = { .name = "agent_fall", .desc = "Number of failed agent checks before declaring a server DOWN (server 'fall' setting)" }, - [ST_F_AGENT_HEALTH] = { .name = "agent_health", .desc = "Current server agent check level (0..fall-1=DOWN, fall..rise-1=UP)" }, - [ST_F_ADDR] = { .name = "addr", .desc = "Server's address:port, shown only if show-legends is set, or at levels oper/admin for the CLI" }, - [ST_F_COOKIE] = { .name = "cookie", .desc = "Backend's cookie name or Server's cookie value, shown only if show-legends is set, or at levels oper/admin for the CLI" }, - [ST_F_MODE] = { .name = "mode", .desc = "'mode' setting (tcp/http/health/cli)" }, - [ST_F_ALGO] = { .name = "algo", .desc = "Backend's load balancing algorithm, shown only if show-legends is set, or at levels oper/admin for the CLI" }, - [ST_F_CONN_RATE] = { .name = "conn_rate", .desc = "Number of new connections accepted over the last second on the frontend for this worker process" }, - [ST_F_CONN_RATE_MAX] = { .name = "conn_rate_max", .desc = "Highest value of connections per second observed since the worker process started" }, - [ST_F_CONN_TOT] = { .name = "conn_tot", .desc = "Total number of new connections accepted on this frontend since the worker process started" }, - [ST_F_INTERCEPTED] = { .name = "intercepted", .desc = "Total number of HTTP requests intercepted on the frontend (redirects/stats/services) since the worker process started" }, - [ST_F_DCON] = { .name = "dcon", .desc = "Total number of incoming connections blocked on a listener/frontend by a tcp-request connection rule since the worker process started" }, - [ST_F_DSES] = { .name = "dses", .desc = "Total number of incoming sessions blocked on a listener/frontend by a tcp-request connection rule since the worker process started" }, - [ST_F_WREW] = { .name = "wrew", .desc = "Total number of failed HTTP header rewrites since the worker process started" }, - [ST_F_CONNECT] = { .name = "connect", .desc = "Total number of outgoing connection attempts on this backend/server since the worker process started" }, - [ST_F_REUSE] = { .name = "reuse", .desc = "Total number of reused connection on this backend/server since the worker process started" }, - [ST_F_CACHE_LOOKUPS] = { .name = "cache_lookups", .desc = "Total number of HTTP requests looked up in the cache on this frontend/backend since the worker process started" }, - [ST_F_CACHE_HITS] = { .name = "cache_hits", .desc = "Total number of HTTP requests not found in the cache on this frontend/backend since the worker process started" }, - [ST_F_SRV_ICUR] = { .name = "srv_icur", .desc = "Current number of idle connections available for reuse on this server" }, - [ST_F_SRV_ILIM] = { .name = "src_ilim", .desc = "Limit on the number of available idle connections on this server (server 'pool_max_conn' directive)" }, - [ST_F_QT_MAX] = { .name = "qtime_max", .desc = "Maximum observed time spent in the queue, in milliseconds (backend/server)" }, - [ST_F_CT_MAX] = { .name = "ctime_max", .desc = "Maximum observed time spent waiting for a connection to complete, in milliseconds (backend/server)" }, - [ST_F_RT_MAX] = { .name = "rtime_max", .desc = "Maximum observed time spent waiting for a server response, in milliseconds (backend/server)" }, - [ST_F_TT_MAX] = { .name = "ttime_max", .desc = "Maximum observed total request+response time (request+queue+connect+response+processing), in milliseconds (backend/server)" }, - [ST_F_EINT] = { .name = "eint", .desc = "Total number of internal errors since process started"}, - [ST_F_IDLE_CONN_CUR] = { .name = "idle_conn_cur", .desc = "Current number of unsafe idle connections"}, - [ST_F_SAFE_CONN_CUR] = { .name = "safe_conn_cur", .desc = "Current number of safe idle connections"}, - [ST_F_USED_CONN_CUR] = { .name = "used_conn_cur", .desc = "Current number of connections in use"}, - [ST_F_NEED_CONN_EST] = { .name = "need_conn_est", .desc = "Estimated needed number of connections"}, - [ST_F_UWEIGHT] = { .name = "uweight", .desc = "Server's user weight, or sum of active servers' user weights for a backend" }, - [ST_F_AGG_SRV_CHECK_STATUS] = { .name = "agg_server_check_status", .desc = "[DEPRECATED] Backend's aggregated gauge of servers' status" }, - [ST_F_AGG_SRV_STATUS ] = { .name = "agg_server_status", .desc = "Backend's aggregated gauge of servers' status" }, - [ST_F_AGG_CHECK_STATUS] = { .name = "agg_check_status", .desc = "Backend's aggregated gauge of servers' state check status" }, - [ST_F_SRID] = { .name = "srid", .desc = "Server id revision, to prevent server id reuse mixups" }, - [ST_F_SESS_OTHER] = { .name = "sess_other", .desc = "Total number of sessions other than HTTP since process started" }, - [ST_F_H1SESS] = { .name = "h1sess", .desc = "Total number of HTTP/1 sessions since process started" }, - [ST_F_H2SESS] = { .name = "h2sess", .desc = "Total number of HTTP/2 sessions since process started" }, - [ST_F_H3SESS] = { .name = "h3sess", .desc = "Total number of HTTP/3 sessions since process started" }, - [ST_F_REQ_OTHER] = { .name = "req_other", .desc = "Total number of sessions other than HTTP processed by this object since the worker process started" }, - [ST_F_H1REQ] = { .name = "h1req", .desc = "Total number of HTTP/1 sessions processed by this object since the worker process started" }, - [ST_F_H2REQ] = { .name = "h2req", .desc = "Total number of hTTP/2 sessions processed by this object since the worker process started" }, - [ST_F_H3REQ] = { .name = "h3req", .desc = "Total number of HTTP/3 sessions processed by this object since the worker process started" }, - [ST_F_PROTO] = { .name = "proto", .desc = "Protocol" }, -}; - /* one line of info */ THREAD_LOCAL struct field info[INF_TOTAL_FIELDS]; +const struct name_desc metrics_px[ST_I_PX_MAX] = { + [ST_I_PX_PXNAME] = { .name = "pxname", .desc = "Proxy name" }, + [ST_I_PX_SVNAME] = { .name = "svname", .desc = "Server name" }, + [ST_I_PX_QCUR] = { .name = "qcur", .desc = "Number of current queued connections" }, + [ST_I_PX_QMAX] = { .name = "qmax", .desc = "Highest value of queued connections encountered since process started" }, + [ST_I_PX_SCUR] = { .name = "scur", .desc = "Number of current sessions on the frontend, backend or server" }, + [ST_I_PX_SMAX] = { .name = "smax", .desc = "Highest value of current sessions encountered since process started" }, + [ST_I_PX_SLIM] = { .name = "slim", .desc = "Frontend/listener/server's maxconn, backend's fullconn" }, + [ST_I_PX_STOT] = { .name = "stot", .desc = "Total number of sessions since process started" }, + [ST_I_PX_BIN] = { .name = "bin", .desc = "Total number of request bytes since process started" }, + [ST_I_PX_BOUT] = { .name = "bout", .desc = "Total number of response bytes since process started" }, + [ST_I_PX_DREQ] = { .name = "dreq", .desc = "Total number of denied requests since process started" }, + [ST_I_PX_DRESP] = { .name = "dresp", .desc = "Total number of denied responses since process started" }, + [ST_I_PX_EREQ] = { .name = "ereq", .desc = "Total number of invalid requests since process started" }, + [ST_I_PX_ECON] = { .name = "econ", .desc = "Total number of failed connections to server since the worker process started" }, + [ST_I_PX_ERESP] = { .name = "eresp", .desc = "Total number of invalid responses since the worker process started" }, + [ST_I_PX_WRETR] = { .name = "wretr", .desc = "Total number of server connection retries since the worker process started" }, + [ST_I_PX_WREDIS] = { .name = "wredis", .desc = "Total number of server redispatches due to connection failures since the worker process started" }, + [ST_I_PX_STATUS] = { .name = "status", .desc = "Frontend/listen status: OPEN/WAITING/FULL/STOP; backend: UP/DOWN; server: last check status" }, + [ST_I_PX_WEIGHT] = { .name = "weight", .desc = "Server's effective weight, or sum of active servers' effective weights for a backend" }, + [ST_I_PX_ACT] = { .name = "act", .desc = "Total number of active UP servers with a non-zero weight" }, + [ST_I_PX_BCK] = { .name = "bck", .desc = "Total number of backup UP servers with a non-zero weight" }, + [ST_I_PX_CHKFAIL] = { .name = "chkfail", .desc = "Total number of failed individual health checks per server/backend, since the worker process started" }, + [ST_I_PX_CHKDOWN] = { .name = "chkdown", .desc = "Total number of failed checks causing UP to DOWN server transitions, per server/backend, since the worker process started" }, + [ST_I_PX_LASTCHG] = { .name = "lastchg", .desc = "How long ago the last server state changed, in seconds" }, + [ST_I_PX_DOWNTIME] = { .name = "downtime", .desc = "Total time spent in DOWN state, for server or backend" }, + [ST_I_PX_QLIMIT] = { .name = "qlimit", .desc = "Limit on the number of connections in queue, for servers only (maxqueue argument)" }, + [ST_I_PX_PID] = { .name = "pid", .desc = "Relative worker process number (1)" }, + [ST_I_PX_IID] = { .name = "iid", .desc = "Frontend or Backend numeric identifier ('id' setting)" }, + [ST_I_PX_SID] = { .name = "sid", .desc = "Server numeric identifier ('id' setting)" }, + [ST_I_PX_THROTTLE] = { .name = "throttle", .desc = "Throttling ratio applied to a server's maxconn and weight during the slowstart period (0 to 100%)" }, + [ST_I_PX_LBTOT] = { .name = "lbtot", .desc = "Total number of requests routed by load balancing since the worker process started (ignores queue pop and stickiness)" }, + [ST_I_PX_TRACKED] = { .name = "tracked", .desc = "Name of the other server this server tracks for its state" }, + [ST_I_PX_TYPE] = { .name = "type", .desc = "Type of the object (Listener, Frontend, Backend, Server)" }, + [ST_I_PX_RATE] = { .name = "rate", .desc = "Total number of sessions processed by this object over the last second (sessions for listeners/frontends, requests for backends/servers)" }, + [ST_I_PX_RATE_LIM] = { .name = "rate_lim", .desc = "Limit on the number of sessions accepted in a second (frontend only, 'rate-limit sessions' setting)" }, + [ST_I_PX_RATE_MAX] = { .name = "rate_max", .desc = "Highest value of sessions per second observed since the worker process started" }, + [ST_I_PX_CHECK_STATUS] = { .name = "check_status", .desc = "Status report of the server's latest health check, prefixed with '*' if a check is currently in progress" }, + [ST_I_PX_CHECK_CODE] = { .name = "check_code", .desc = "HTTP/SMTP/LDAP status code reported by the latest server health check" }, + [ST_I_PX_CHECK_DURATION] = { .name = "check_duration", .desc = "Total duration of the latest server health check, in milliseconds" }, + [ST_I_PX_HRSP_1XX] = { .name = "hrsp_1xx", .desc = "Total number of HTTP responses with status 100-199 returned by this object since the worker process started" }, + [ST_I_PX_HRSP_2XX] = { .name = "hrsp_2xx", .desc = "Total number of HTTP responses with status 200-299 returned by this object since the worker process started" }, + [ST_I_PX_HRSP_3XX] = { .name = "hrsp_3xx", .desc = "Total number of HTTP responses with status 300-399 returned by this object since the worker process started" }, + [ST_I_PX_HRSP_4XX] = { .name = "hrsp_4xx", .desc = "Total number of HTTP responses with status 400-499 returned by this object since the worker process started" }, + [ST_I_PX_HRSP_5XX] = { .name = "hrsp_5xx", .desc = "Total number of HTTP responses with status 500-599 returned by this object since the worker process started" }, + [ST_I_PX_HRSP_OTHER] = { .name = "hrsp_other", .desc = "Total number of HTTP responses with status <100, >599 returned by this object since the worker process started (error -1 included)" }, + [ST_I_PX_HANAFAIL] = { .name = "hanafail", .desc = "Total number of failed checks caused by an 'on-error' directive after an 'observe' condition matched" }, + [ST_I_PX_REQ_RATE] = { .name = "req_rate", .desc = "Number of HTTP requests processed over the last second on this object" }, + [ST_I_PX_REQ_RATE_MAX] = { .name = "req_rate_max", .desc = "Highest value of http requests observed since the worker process started" }, + [ST_I_PX_REQ_TOT] = { .name = "req_tot", .desc = "Total number of HTTP requests processed by this object since the worker process started" }, + [ST_I_PX_CLI_ABRT] = { .name = "cli_abrt", .desc = "Total number of requests or connections aborted by the client since the worker process started" }, + [ST_I_PX_SRV_ABRT] = { .name = "srv_abrt", .desc = "Total number of requests or connections aborted by the server since the worker process started" }, + [ST_I_PX_COMP_IN] = { .name = "comp_in", .desc = "Total number of bytes submitted to the HTTP compressor for this object since the worker process started" }, + [ST_I_PX_COMP_OUT] = { .name = "comp_out", .desc = "Total number of bytes emitted by the HTTP compressor for this object since the worker process started" }, + [ST_I_PX_COMP_BYP] = { .name = "comp_byp", .desc = "Total number of bytes that bypassed HTTP compression for this object since the worker process started (CPU/memory/bandwidth limitation)" }, + [ST_I_PX_COMP_RSP] = { .name = "comp_rsp", .desc = "Total number of HTTP responses that were compressed for this object since the worker process started" }, + [ST_I_PX_LASTSESS] = { .name = "lastsess", .desc = "How long ago some traffic was seen on this object on this worker process, in seconds" }, + [ST_I_PX_LAST_CHK] = { .name = "last_chk", .desc = "Short description of the latest health check report for this server (see also check_desc)" }, + [ST_I_PX_LAST_AGT] = { .name = "last_agt", .desc = "Short description of the latest agent check report for this server (see also agent_desc)" }, + [ST_I_PX_QTIME] = { .name = "qtime", .desc = "Time spent in the queue, in milliseconds, averaged over the 1024 last requests (backend/server)" }, + [ST_I_PX_CTIME] = { .name = "ctime", .desc = "Time spent waiting for a connection to complete, in milliseconds, averaged over the 1024 last requests (backend/server)" }, + [ST_I_PX_RTIME] = { .name = "rtime", .desc = "Time spent waiting for a server response, in milliseconds, averaged over the 1024 last requests (backend/server)" }, + [ST_I_PX_TTIME] = { .name = "ttime", .desc = "Total request+response time (request+queue+connect+response+processing), in milliseconds, averaged over the 1024 last requests (backend/server)" }, + [ST_I_PX_AGENT_STATUS] = { .name = "agent_status", .desc = "Status report of the server's latest agent check, prefixed with '*' if a check is currently in progress" }, + [ST_I_PX_AGENT_CODE] = { .name = "agent_code", .desc = "Status code reported by the latest server agent check" }, + [ST_I_PX_AGENT_DURATION] = { .name = "agent_duration", .desc = "Total duration of the latest server agent check, in milliseconds" }, + [ST_I_PX_CHECK_DESC] = { .name = "check_desc", .desc = "Textual description of the latest health check report for this server" }, + [ST_I_PX_AGENT_DESC] = { .name = "agent_desc", .desc = "Textual description of the latest agent check report for this server" }, + [ST_I_PX_CHECK_RISE] = { .name = "check_rise", .desc = "Number of successful health checks before declaring a server UP (server 'rise' setting)" }, + [ST_I_PX_CHECK_FALL] = { .name = "check_fall", .desc = "Number of failed health checks before declaring a server DOWN (server 'fall' setting)" }, + [ST_I_PX_CHECK_HEALTH] = { .name = "check_health", .desc = "Current server health check level (0..fall-1=DOWN, fall..rise-1=UP)" }, + [ST_I_PX_AGENT_RISE] = { .name = "agent_rise", .desc = "Number of successful agent checks before declaring a server UP (server 'rise' setting)" }, + [ST_I_PX_AGENT_FALL] = { .name = "agent_fall", .desc = "Number of failed agent checks before declaring a server DOWN (server 'fall' setting)" }, + [ST_I_PX_AGENT_HEALTH] = { .name = "agent_health", .desc = "Current server agent check level (0..fall-1=DOWN, fall..rise-1=UP)" }, + [ST_I_PX_ADDR] = { .name = "addr", .desc = "Server's address:port, shown only if show-legends is set, or at levels oper/admin for the CLI" }, + [ST_I_PX_COOKIE] = { .name = "cookie", .desc = "Backend's cookie name or Server's cookie value, shown only if show-legends is set, or at levels oper/admin for the CLI" }, + [ST_I_PX_MODE] = { .name = "mode", .desc = "'mode' setting (tcp/http/health/cli)" }, + [ST_I_PX_ALGO] = { .name = "algo", .desc = "Backend's load balancing algorithm, shown only if show-legends is set, or at levels oper/admin for the CLI" }, + [ST_I_PX_CONN_RATE] = { .name = "conn_rate", .desc = "Number of new connections accepted over the last second on the frontend for this worker process" }, + [ST_I_PX_CONN_RATE_MAX] = { .name = "conn_rate_max", .desc = "Highest value of connections per second observed since the worker process started" }, + [ST_I_PX_CONN_TOT] = { .name = "conn_tot", .desc = "Total number of new connections accepted on this frontend since the worker process started" }, + [ST_I_PX_INTERCEPTED] = { .name = "intercepted", .desc = "Total number of HTTP requests intercepted on the frontend (redirects/stats/services) since the worker process started" }, + [ST_I_PX_DCON] = { .name = "dcon", .desc = "Total number of incoming connections blocked on a listener/frontend by a tcp-request connection rule since the worker process started" }, + [ST_I_PX_DSES] = { .name = "dses", .desc = "Total number of incoming sessions blocked on a listener/frontend by a tcp-request connection rule since the worker process started" }, + [ST_I_PX_WREW] = { .name = "wrew", .desc = "Total number of failed HTTP header rewrites since the worker process started" }, + [ST_I_PX_CONNECT] = { .name = "connect", .desc = "Total number of outgoing connection attempts on this backend/server since the worker process started" }, + [ST_I_PX_REUSE] = { .name = "reuse", .desc = "Total number of reused connection on this backend/server since the worker process started" }, + [ST_I_PX_CACHE_LOOKUPS] = { .name = "cache_lookups", .desc = "Total number of HTTP requests looked up in the cache on this frontend/backend since the worker process started" }, + [ST_I_PX_CACHE_HITS] = { .name = "cache_hits", .desc = "Total number of HTTP requests not found in the cache on this frontend/backend since the worker process started" }, + [ST_I_PX_SRV_ICUR] = { .name = "srv_icur", .desc = "Current number of idle connections available for reuse on this server" }, + [ST_I_PX_SRV_ILIM] = { .name = "src_ilim", .desc = "Limit on the number of available idle connections on this server (server 'pool_max_conn' directive)" }, + [ST_I_PX_QT_MAX] = { .name = "qtime_max", .desc = "Maximum observed time spent in the queue, in milliseconds (backend/server)" }, + [ST_I_PX_CT_MAX] = { .name = "ctime_max", .desc = "Maximum observed time spent waiting for a connection to complete, in milliseconds (backend/server)" }, + [ST_I_PX_RT_MAX] = { .name = "rtime_max", .desc = "Maximum observed time spent waiting for a server response, in milliseconds (backend/server)" }, + [ST_I_PX_TT_MAX] = { .name = "ttime_max", .desc = "Maximum observed total request+response time (request+queue+connect+response+processing), in milliseconds (backend/server)" }, + [ST_I_PX_EINT] = { .name = "eint", .desc = "Total number of internal errors since process started"}, + [ST_I_PX_IDLE_CONN_CUR] = { .name = "idle_conn_cur", .desc = "Current number of unsafe idle connections"}, + [ST_I_PX_SAFE_CONN_CUR] = { .name = "safe_conn_cur", .desc = "Current number of safe idle connections"}, + [ST_I_PX_USED_CONN_CUR] = { .name = "used_conn_cur", .desc = "Current number of connections in use"}, + [ST_I_PX_NEED_CONN_EST] = { .name = "need_conn_est", .desc = "Estimated needed number of connections"}, + [ST_I_PX_UWEIGHT] = { .name = "uweight", .desc = "Server's user weight, or sum of active servers' user weights for a backend" }, + [ST_I_PX_AGG_SRV_CHECK_STATUS] = { .name = "agg_server_check_status", .desc = "[DEPRECATED] Backend's aggregated gauge of servers' status" }, + [ST_I_PX_AGG_SRV_STATUS ] = { .name = "agg_server_status", .desc = "Backend's aggregated gauge of servers' status" }, + [ST_I_PX_AGG_CHECK_STATUS] = { .name = "agg_check_status", .desc = "Backend's aggregated gauge of servers' state check status" }, + [ST_I_PX_SRID] = { .name = "srid", .desc = "Server id revision, to prevent server id reuse mixups" }, + [ST_I_PX_SESS_OTHER] = { .name = "sess_other", .desc = "Total number of sessions other than HTTP since process started" }, + [ST_I_PX_H1SESS] = { .name = "h1sess", .desc = "Total number of HTTP/1 sessions since process started" }, + [ST_I_PX_H2SESS] = { .name = "h2sess", .desc = "Total number of HTTP/2 sessions since process started" }, + [ST_I_PX_H3SESS] = { .name = "h3sess", .desc = "Total number of HTTP/3 sessions since process started" }, + [ST_I_PX_REQ_OTHER] = { .name = "req_other", .desc = "Total number of sessions other than HTTP processed by this object since the worker process started" }, + [ST_I_PX_H1REQ] = { .name = "h1req", .desc = "Total number of HTTP/1 sessions processed by this object since the worker process started" }, + [ST_I_PX_H2REQ] = { .name = "h2req", .desc = "Total number of hTTP/2 sessions processed by this object since the worker process started" }, + [ST_I_PX_H3REQ] = { .name = "h3req", .desc = "Total number of HTTP/3 sessions processed by this object since the worker process started" }, + [ST_I_PX_PROTO] = { .name = "proto", .desc = "Protocol" }, +}; + +/* one line for stats */ +THREAD_LOCAL struct field *stat_l[STATS_DOMAIN_COUNT]; + /* description of statistics (static and dynamic) */ struct name_desc *stat_f[STATS_DOMAIN_COUNT]; static size_t stat_count[STATS_DOMAIN_COUNT]; -/* one line for stats */ -THREAD_LOCAL struct field *stat_l[STATS_DOMAIN_COUNT]; - /* list of all registered stats module */ struct list stats_module_list[STATS_DOMAIN_COUNT] = { LIST_HEAD_INIT(stats_module_list[STATS_DOMAIN_PROXY]), @@ -406,7 +406,7 @@ static void stats_dump_csv_header(enum stats_domain domain, struct buffer *out) /* print special delimiter on proxy stats to mark end of static fields */ - if (domain == STATS_DOMAIN_PROXY && field + 1 == ST_F_TOTAL_FIELDS) + if (domain == STATS_DOMAIN_PROXY && field + 1 == ST_I_PX_MAX) chunk_appendf(out, "-,"); } } @@ -517,7 +517,7 @@ static int stats_dump_fields_csv(struct buffer *out, /* print special delimiter on proxy stats to mark end of static fields */ - if (domain == STATS_DOMAIN_PROXY && field + 1 == ST_F_TOTAL_FIELDS) { + if (domain == STATS_DOMAIN_PROXY && field + 1 == ST_I_PX_MAX) { if (!chunk_strcat(out, "-,")) return 0; } @@ -544,15 +544,15 @@ static int stats_dump_fields_typed(struct buffer *out, switch (domain) { case STATS_DOMAIN_PROXY: chunk_appendf(out, "%c.%u.%u.%d.%s.%u:", - stats[ST_F_TYPE].u.u32 == STATS_TYPE_FE ? 'F' : - stats[ST_F_TYPE].u.u32 == STATS_TYPE_BE ? 'B' : - stats[ST_F_TYPE].u.u32 == STATS_TYPE_SO ? 'L' : - stats[ST_F_TYPE].u.u32 == STATS_TYPE_SV ? 'S' : + stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_FE ? 'F' : + stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_BE ? 'B' : + stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_SO ? 'L' : + stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_SV ? 'S' : '?', - stats[ST_F_IID].u.u32, stats[ST_F_SID].u.u32, + stats[ST_I_PX_IID].u.u32, stats[ST_I_PX_SID].u.u32, field, stat_f[domain][field].name, - stats[ST_F_PID].u.u32); + stats[ST_I_PX_PID].u.u32); break; case STATS_DOMAIN_RESOLVERS: @@ -602,7 +602,7 @@ int stats_dump_one_line(const struct field *stats, size_t stats_count, /* Fill with the frontend statistics. is preallocated array of * length . If is != NULL, only fill this one. The length - * of the array must be at least ST_F_TOTAL_FIELDS. If this length is less than + * of the array must be at least ST_I_PX_MAX. If this length is less than * this value, or if the selected field is not implemented for frontends, the * function returns 0, otherwise, it returns 1. */ @@ -611,56 +611,56 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len, { enum stat_field current_field = (selected_field != NULL ? *selected_field : 0); - if (len < ST_F_TOTAL_FIELDS) + if (len < ST_I_PX_MAX) return 0; - for (; current_field < ST_F_TOTAL_FIELDS; current_field++) { + for (; current_field < ST_I_PX_MAX; current_field++) { struct field metric = { 0 }; switch (current_field) { - case ST_F_PXNAME: + case ST_I_PX_PXNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, px->id); break; - case ST_F_SVNAME: + case ST_I_PX_SVNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, "FRONTEND"); break; - case ST_F_MODE: + case ST_I_PX_MODE: metric = mkf_str(FO_CONFIG|FS_SERVICE, proxy_mode_str(px->mode)); break; - case ST_F_SCUR: + case ST_I_PX_SCUR: metric = mkf_u32(0, px->feconn); break; - case ST_F_SMAX: + case ST_I_PX_SMAX: metric = mkf_u32(FN_MAX, px->fe_counters.conn_max); break; - case ST_F_SLIM: + case ST_I_PX_SLIM: metric = mkf_u32(FO_CONFIG|FN_LIMIT, px->maxconn); break; - case ST_F_STOT: + case ST_I_PX_STOT: metric = mkf_u64(FN_COUNTER, px->fe_counters.cum_sess); break; - case ST_F_BIN: + case ST_I_PX_BIN: metric = mkf_u64(FN_COUNTER, px->fe_counters.bytes_in); break; - case ST_F_BOUT: + case ST_I_PX_BOUT: metric = mkf_u64(FN_COUNTER, px->fe_counters.bytes_out); break; - case ST_F_DREQ: + case ST_I_PX_DREQ: metric = mkf_u64(FN_COUNTER, px->fe_counters.denied_req); break; - case ST_F_DRESP: + case ST_I_PX_DRESP: metric = mkf_u64(FN_COUNTER, px->fe_counters.denied_resp); break; - case ST_F_EREQ: + case ST_I_PX_EREQ: metric = mkf_u64(FN_COUNTER, px->fe_counters.failed_req); break; - case ST_F_DCON: + case ST_I_PX_DCON: metric = mkf_u64(FN_COUNTER, px->fe_counters.denied_conn); break; - case ST_F_DSES: + case ST_I_PX_DSES: metric = mkf_u64(FN_COUNTER, px->fe_counters.denied_sess); break; - case ST_F_STATUS: { + case ST_I_PX_STATUS: { const char *state; if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) @@ -672,76 +672,76 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len, metric = mkf_str(FO_STATUS, state); break; } - case ST_F_PID: + case ST_I_PX_PID: metric = mkf_u32(FO_KEY, 1); break; - case ST_F_IID: + case ST_I_PX_IID: metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid); break; - case ST_F_SID: + case ST_I_PX_SID: metric = mkf_u32(FO_KEY|FS_SERVICE, 0); break; - case ST_F_TYPE: + case ST_I_PX_TYPE: metric = mkf_u32(FO_CONFIG|FS_SERVICE, STATS_TYPE_FE); break; - case ST_F_RATE: + case ST_I_PX_RATE: metric = mkf_u32(FN_RATE, read_freq_ctr(&px->fe_sess_per_sec)); break; - case ST_F_RATE_LIM: + case ST_I_PX_RATE_LIM: metric = mkf_u32(FO_CONFIG|FN_LIMIT, px->fe_sps_lim); break; - case ST_F_RATE_MAX: + case ST_I_PX_RATE_MAX: metric = mkf_u32(FN_MAX, px->fe_counters.sps_max); break; - case ST_F_WREW: + case ST_I_PX_WREW: metric = mkf_u64(FN_COUNTER, px->fe_counters.failed_rewrites); break; - case ST_F_EINT: + case ST_I_PX_EINT: metric = mkf_u64(FN_COUNTER, px->fe_counters.internal_errors); break; - case ST_F_HRSP_1XX: + case ST_I_PX_HRSP_1XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[1]); break; - case ST_F_HRSP_2XX: + case ST_I_PX_HRSP_2XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[2]); break; - case ST_F_HRSP_3XX: + case ST_I_PX_HRSP_3XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[3]); break; - case ST_F_HRSP_4XX: + case ST_I_PX_HRSP_4XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[4]); break; - case ST_F_HRSP_5XX: + case ST_I_PX_HRSP_5XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[5]); break; - case ST_F_HRSP_OTHER: + case ST_I_PX_HRSP_OTHER: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[0]); break; - case ST_F_INTERCEPTED: + case ST_I_PX_INTERCEPTED: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.intercepted_req); break; - case ST_F_CACHE_LOOKUPS: + case ST_I_PX_CACHE_LOOKUPS: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cache_lookups); break; - case ST_F_CACHE_HITS: + case ST_I_PX_CACHE_HITS: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cache_hits); break; - case ST_F_REQ_RATE: + case ST_I_PX_REQ_RATE: metric = mkf_u32(FN_RATE, read_freq_ctr(&px->fe_req_per_sec)); break; - case ST_F_REQ_RATE_MAX: + case ST_I_PX_REQ_RATE_MAX: metric = mkf_u32(FN_MAX, px->fe_counters.p.http.rps_max); break; - case ST_F_REQ_TOT: { + case ST_I_PX_REQ_TOT: { int i; uint64_t total_req; size_t nb_reqs = @@ -753,28 +753,28 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len, metric = mkf_u64(FN_COUNTER, total_req); break; } - case ST_F_COMP_IN: + case ST_I_PX_COMP_IN: metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_in[COMP_DIR_RES]); break; - case ST_F_COMP_OUT: + case ST_I_PX_COMP_OUT: metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_out[COMP_DIR_RES]); break; - case ST_F_COMP_BYP: + case ST_I_PX_COMP_BYP: metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_byp[COMP_DIR_RES]); break; - case ST_F_COMP_RSP: + case ST_I_PX_COMP_RSP: metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.comp_rsp); break; - case ST_F_CONN_RATE: + case ST_I_PX_CONN_RATE: metric = mkf_u32(FN_RATE, read_freq_ctr(&px->fe_conn_per_sec)); break; - case ST_F_CONN_RATE_MAX: + case ST_I_PX_CONN_RATE_MAX: metric = mkf_u32(FN_MAX, px->fe_counters.cps_max); break; - case ST_F_CONN_TOT: + case ST_I_PX_CONN_TOT: metric = mkf_u64(FN_COUNTER, px->fe_counters.cum_conn); break; - case ST_F_SESS_OTHER: { + case ST_I_PX_SESS_OTHER: { int i; uint64_t total_sess; size_t nb_sess = @@ -787,25 +787,25 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len, metric = mkf_u64(FN_COUNTER, total_sess); break; } - case ST_F_H1SESS: + case ST_I_PX_H1SESS: metric = mkf_u64(FN_COUNTER, px->fe_counters.cum_sess_ver[0]); break; - case ST_F_H2SESS: + case ST_I_PX_H2SESS: metric = mkf_u64(FN_COUNTER, px->fe_counters.cum_sess_ver[1]); break; - case ST_F_H3SESS: + case ST_I_PX_H3SESS: metric = mkf_u64(FN_COUNTER, px->fe_counters.cum_sess_ver[2]); break; - case ST_F_REQ_OTHER: + case ST_I_PX_REQ_OTHER: metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cum_req[0]); break; - case ST_F_H1REQ: + case ST_I_PX_H1REQ: metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cum_req[1]); break; - case ST_F_H2REQ: + case ST_I_PX_H2REQ: metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cum_req[2]); break; - case ST_F_H3REQ: + case ST_I_PX_H3REQ: metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cum_req[3]); break; default: @@ -834,7 +834,7 @@ static int stats_dump_fe_stats(struct stconn *sc, struct proxy *px) struct show_stat_ctx *ctx = appctx->svcctx; struct field *stats = stat_l[STATS_DOMAIN_PROXY]; struct stats_module *mod; - size_t stats_count = ST_F_TOTAL_FIELDS; + size_t stats_count = ST_I_PX_MAX; if (!(px->cap & PR_CAP_FE)) return 0; @@ -844,7 +844,7 @@ static int stats_dump_fe_stats(struct stconn *sc, struct proxy *px) memset(stats, 0, sizeof(struct field) * stat_count[STATS_DOMAIN_PROXY]); - if (!stats_fill_fe_stats(px, stats, ST_F_TOTAL_FIELDS, NULL)) + if (!stats_fill_fe_stats(px, stats, ST_I_PX_MAX, NULL)) return 0; list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { @@ -865,7 +865,7 @@ static int stats_dump_fe_stats(struct stconn *sc, struct proxy *px) } /* Fill with the listener statistics. is preallocated array of - * length . The length of the array must be at least ST_F_TOTAL_FIELDS. If + * length . The length of the array must be at least ST_I_PX_MAX. If * this length is less then this value, the function returns 0, otherwise, it * returns 1. If selected_field is != NULL, only fill this one. can * take the value STAT_SHLGNDS. @@ -876,7 +876,7 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, enum stat_field current_field = (selected_field != NULL ? *selected_field : 0); struct buffer *out = get_trash_chunk(); - if (len < ST_F_TOTAL_FIELDS) + if (len < ST_I_PX_MAX) return 0; if (!l->counters) @@ -884,77 +884,77 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, chunk_reset(out); - for (; current_field < ST_F_TOTAL_FIELDS; current_field++) { + for (; current_field < ST_I_PX_MAX; current_field++) { struct field metric = { 0 }; switch (current_field) { - case ST_F_PXNAME: + case ST_I_PX_PXNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, px->id); break; - case ST_F_SVNAME: + case ST_I_PX_SVNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, l->name); break; - case ST_F_MODE: + case ST_I_PX_MODE: metric = mkf_str(FO_CONFIG|FS_SERVICE, proxy_mode_str(px->mode)); break; - case ST_F_SCUR: + case ST_I_PX_SCUR: metric = mkf_u32(0, l->nbconn); break; - case ST_F_SMAX: + case ST_I_PX_SMAX: metric = mkf_u32(FN_MAX, l->counters->conn_max); break; - case ST_F_SLIM: + case ST_I_PX_SLIM: metric = mkf_u32(FO_CONFIG|FN_LIMIT, l->bind_conf->maxconn); break; - case ST_F_STOT: + case ST_I_PX_STOT: metric = mkf_u64(FN_COUNTER, l->counters->cum_sess); break; - case ST_F_BIN: + case ST_I_PX_BIN: metric = mkf_u64(FN_COUNTER, l->counters->bytes_in); break; - case ST_F_BOUT: + case ST_I_PX_BOUT: metric = mkf_u64(FN_COUNTER, l->counters->bytes_out); break; - case ST_F_DREQ: + case ST_I_PX_DREQ: metric = mkf_u64(FN_COUNTER, l->counters->denied_req); break; - case ST_F_DRESP: + case ST_I_PX_DRESP: metric = mkf_u64(FN_COUNTER, l->counters->denied_resp); break; - case ST_F_EREQ: + case ST_I_PX_EREQ: metric = mkf_u64(FN_COUNTER, l->counters->failed_req); break; - case ST_F_DCON: + case ST_I_PX_DCON: metric = mkf_u64(FN_COUNTER, l->counters->denied_conn); break; - case ST_F_DSES: + case ST_I_PX_DSES: metric = mkf_u64(FN_COUNTER, l->counters->denied_sess); break; - case ST_F_STATUS: + case ST_I_PX_STATUS: metric = mkf_str(FO_STATUS, li_status_st[get_li_status(l)]); break; - case ST_F_PID: + case ST_I_PX_PID: metric = mkf_u32(FO_KEY, 1); break; - case ST_F_IID: + case ST_I_PX_IID: metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid); break; - case ST_F_SID: + case ST_I_PX_SID: metric = mkf_u32(FO_KEY|FS_SERVICE, l->luid); break; - case ST_F_TYPE: + case ST_I_PX_TYPE: metric = mkf_u32(FO_CONFIG|FS_SERVICE, STATS_TYPE_SO); break; - case ST_F_CONN_TOT: + case ST_I_PX_CONN_TOT: metric = mkf_u64(FN_COUNTER, l->counters->cum_conn); break; - case ST_F_WREW: + case ST_I_PX_WREW: metric = mkf_u64(FN_COUNTER, l->counters->failed_rewrites); break; - case ST_F_EINT: + case ST_I_PX_EINT: metric = mkf_u64(FN_COUNTER, l->counters->internal_errors); break; - case ST_F_ADDR: + case ST_I_PX_ADDR: if (flags & STAT_SHLGNDS) { char str[INET6_ADDRSTRLEN]; int port; @@ -981,7 +981,7 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, } } break; - case ST_F_PROTO: + case ST_I_PX_PROTO: metric = mkf_str(FO_STATUS, l->rx.proto->name); break; default: @@ -1010,12 +1010,12 @@ static int stats_dump_li_stats(struct stconn *sc, struct proxy *px, struct liste struct show_stat_ctx *ctx = appctx->svcctx; struct field *stats = stat_l[STATS_DOMAIN_PROXY]; struct stats_module *mod; - size_t stats_count = ST_F_TOTAL_FIELDS; + size_t stats_count = ST_I_PX_MAX; memset(stats, 0, sizeof(struct field) * stat_count[STATS_DOMAIN_PROXY]); if (!stats_fill_li_stats(px, l, ctx->flags, stats, - ST_F_TOTAL_FIELDS, NULL)) + ST_I_PX_MAX, NULL)) return 0; list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { @@ -1114,7 +1114,7 @@ static void stats_fill_sv_stats_computestate(struct server *sv, struct server *r /* Fill with the backend statistics. is preallocated array of * length . If is != NULL, only fill this one. The length - * of the array must be at least ST_F_TOTAL_FIELDS. If this length is less than + * of the array must be at least ST_I_PX_MAX. If this length is less than * this value, or if the selected field is not implemented for servers, the * function returns 0, otherwise, it returns 1. can take the value * STAT_SHLGNDS. @@ -1133,15 +1133,15 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, long long srv_samples_counter; unsigned int srv_samples_window = TIME_STATS_SAMPLES; - if (len < ST_F_TOTAL_FIELDS) + if (len < ST_I_PX_MAX) return 0; chunk_reset(out); /* compute state for later use */ - if (selected_field == NULL || *selected_field == ST_F_STATUS || - *selected_field == ST_F_CHECK_RISE || *selected_field == ST_F_CHECK_FALL || - *selected_field == ST_F_CHECK_HEALTH || *selected_field == ST_F_HANAFAIL) { + if (selected_field == NULL || *selected_field == ST_I_PX_STATUS || + *selected_field == ST_I_PX_CHECK_RISE || *selected_field == ST_I_PX_CHECK_FALL || + *selected_field == ST_I_PX_CHECK_HEALTH || *selected_field == ST_I_PX_HANAFAIL) { /* we have "via" which is the tracked server as described in the configuration, * and "ref" which is the checked server and the end of the chain. */ @@ -1151,99 +1151,99 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, } /* compue time values for later use */ - if (selected_field == NULL || *selected_field == ST_F_QTIME || - *selected_field == ST_F_CTIME || *selected_field == ST_F_RTIME || - *selected_field == ST_F_TTIME) { + if (selected_field == NULL || *selected_field == ST_I_PX_QTIME || + *selected_field == ST_I_PX_CTIME || *selected_field == ST_I_PX_RTIME || + *selected_field == ST_I_PX_TTIME) { srv_samples_counter = (px->mode == PR_MODE_HTTP) ? sv->counters.p.http.cum_req : sv->counters.cum_lbconn; if (srv_samples_counter < TIME_STATS_SAMPLES && srv_samples_counter > 0) srv_samples_window = srv_samples_counter; } - for (; current_field < ST_F_TOTAL_FIELDS; current_field++) { + for (; current_field < ST_I_PX_MAX; current_field++) { struct field metric = { 0 }; switch (current_field) { - case ST_F_PXNAME: + case ST_I_PX_PXNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, px->id); break; - case ST_F_SVNAME: + case ST_I_PX_SVNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, sv->id); break; - case ST_F_MODE: + case ST_I_PX_MODE: metric = mkf_str(FO_CONFIG|FS_SERVICE, proxy_mode_str(px->mode)); break; - case ST_F_QCUR: + case ST_I_PX_QCUR: metric = mkf_u32(0, sv->queue.length); break; - case ST_F_QMAX: + case ST_I_PX_QMAX: metric = mkf_u32(FN_MAX, sv->counters.nbpend_max); break; - case ST_F_SCUR: + case ST_I_PX_SCUR: metric = mkf_u32(0, sv->cur_sess); break; - case ST_F_SMAX: + case ST_I_PX_SMAX: metric = mkf_u32(FN_MAX, sv->counters.cur_sess_max); break; - case ST_F_SLIM: + case ST_I_PX_SLIM: if (sv->maxconn) metric = mkf_u32(FO_CONFIG|FN_LIMIT, sv->maxconn); break; - case ST_F_SRV_ICUR: + case ST_I_PX_SRV_ICUR: metric = mkf_u32(0, sv->curr_idle_conns); break; - case ST_F_SRV_ILIM: + case ST_I_PX_SRV_ILIM: if (sv->max_idle_conns != -1) metric = mkf_u32(FO_CONFIG|FN_LIMIT, sv->max_idle_conns); break; - case ST_F_STOT: + case ST_I_PX_STOT: metric = mkf_u64(FN_COUNTER, sv->counters.cum_sess); break; - case ST_F_BIN: + case ST_I_PX_BIN: metric = mkf_u64(FN_COUNTER, sv->counters.bytes_in); break; - case ST_F_BOUT: + case ST_I_PX_BOUT: metric = mkf_u64(FN_COUNTER, sv->counters.bytes_out); break; - case ST_F_DRESP: + case ST_I_PX_DRESP: metric = mkf_u64(FN_COUNTER, sv->counters.denied_resp); break; - case ST_F_ECON: + case ST_I_PX_ECON: metric = mkf_u64(FN_COUNTER, sv->counters.failed_conns); break; - case ST_F_ERESP: + case ST_I_PX_ERESP: metric = mkf_u64(FN_COUNTER, sv->counters.failed_resp); break; - case ST_F_WRETR: + case ST_I_PX_WRETR: metric = mkf_u64(FN_COUNTER, sv->counters.retries); break; - case ST_F_WREDIS: + case ST_I_PX_WREDIS: metric = mkf_u64(FN_COUNTER, sv->counters.redispatches); break; - case ST_F_WREW: + case ST_I_PX_WREW: metric = mkf_u64(FN_COUNTER, sv->counters.failed_rewrites); break; - case ST_F_EINT: + case ST_I_PX_EINT: metric = mkf_u64(FN_COUNTER, sv->counters.internal_errors); break; - case ST_F_CONNECT: + case ST_I_PX_CONNECT: metric = mkf_u64(FN_COUNTER, sv->counters.connect); break; - case ST_F_REUSE: + case ST_I_PX_REUSE: metric = mkf_u64(FN_COUNTER, sv->counters.reuse); break; - case ST_F_IDLE_CONN_CUR: + case ST_I_PX_IDLE_CONN_CUR: metric = mkf_u32(0, sv->curr_idle_nb); break; - case ST_F_SAFE_CONN_CUR: + case ST_I_PX_SAFE_CONN_CUR: metric = mkf_u32(0, sv->curr_safe_nb); break; - case ST_F_USED_CONN_CUR: + case ST_I_PX_USED_CONN_CUR: metric = mkf_u32(0, sv->curr_used_conns); break; - case ST_F_NEED_CONN_EST: + case ST_I_PX_NEED_CONN_EST: metric = mkf_u32(0, sv->est_need_conns); break; - case ST_F_STATUS: + case ST_I_PX_STATUS: fld_status = chunk_newstr(out); if (sv->cur_admin & SRV_ADMF_RMAINT) chunk_appendf(out, "MAINT (resolution)"); @@ -1259,73 +1259,73 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, metric = mkf_str(FO_STATUS, fld_status); break; - case ST_F_LASTCHG: + case ST_I_PX_LASTCHG: metric = mkf_u32(FN_AGE, ns_to_sec(now_ns) - sv->last_change); break; - case ST_F_WEIGHT: + case ST_I_PX_WEIGHT: metric = mkf_u32(FN_AVG, (sv->cur_eweight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv); break; - case ST_F_UWEIGHT: + case ST_I_PX_UWEIGHT: metric = mkf_u32(FN_AVG, sv->uweight); break; - case ST_F_ACT: + case ST_I_PX_ACT: metric = mkf_u32(FO_STATUS, (sv->flags & SRV_F_BACKUP) ? 0 : 1); break; - case ST_F_BCK: + case ST_I_PX_BCK: metric = mkf_u32(FO_STATUS, (sv->flags & SRV_F_BACKUP) ? 1 : 0); break; - case ST_F_CHKFAIL: + case ST_I_PX_CHKFAIL: if (sv->check.state & CHK_ST_ENABLED) metric = mkf_u64(FN_COUNTER, sv->counters.failed_checks); break; - case ST_F_CHKDOWN: + case ST_I_PX_CHKDOWN: if (sv->check.state & CHK_ST_ENABLED) metric = mkf_u64(FN_COUNTER, sv->counters.down_trans); break; - case ST_F_DOWNTIME: + case ST_I_PX_DOWNTIME: if (sv->check.state & CHK_ST_ENABLED) metric = mkf_u32(FN_COUNTER, srv_downtime(sv)); break; - case ST_F_QLIMIT: + case ST_I_PX_QLIMIT: if (sv->maxqueue) metric = mkf_u32(FO_CONFIG|FS_SERVICE, sv->maxqueue); break; - case ST_F_PID: + case ST_I_PX_PID: metric = mkf_u32(FO_KEY, 1); break; - case ST_F_IID: + case ST_I_PX_IID: metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid); break; - case ST_F_SID: + case ST_I_PX_SID: metric = mkf_u32(FO_KEY|FS_SERVICE, sv->puid); break; - case ST_F_SRID: + case ST_I_PX_SRID: metric = mkf_u32(FN_COUNTER, sv->rid); break; - case ST_F_THROTTLE: + case ST_I_PX_THROTTLE: if (sv->cur_state == SRV_ST_STARTING && !server_is_draining(sv)) metric = mkf_u32(FN_AVG, server_throttle_rate(sv)); break; - case ST_F_LBTOT: + case ST_I_PX_LBTOT: metric = mkf_u64(FN_COUNTER, sv->counters.cum_lbconn); break; - case ST_F_TRACKED: + case ST_I_PX_TRACKED: if (sv->track) { char *fld_track = chunk_newstr(out); chunk_appendf(out, "%s/%s", sv->track->proxy->id, sv->track->id); metric = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, fld_track); } break; - case ST_F_TYPE: + case ST_I_PX_TYPE: metric = mkf_u32(FO_CONFIG|FS_SERVICE, STATS_TYPE_SV); break; - case ST_F_RATE: + case ST_I_PX_RATE: metric = mkf_u32(FN_RATE, read_freq_ctr(&sv->sess_per_sec)); break; - case ST_F_RATE_MAX: + case ST_I_PX_RATE_MAX: metric = mkf_u32(FN_MAX, sv->counters.sps_max); break; - case ST_F_CHECK_STATUS: + case ST_I_PX_CHECK_STATUS: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) { const char *fld_chksts; @@ -1337,37 +1337,37 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, metric = mkf_str(FN_OUTPUT, fld_chksts); } break; - case ST_F_CHECK_CODE: + case ST_I_PX_CHECK_CODE: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED && sv->check.status >= HCHK_STATUS_L57DATA) metric = mkf_u32(FN_OUTPUT, sv->check.code); break; - case ST_F_CHECK_DURATION: + case ST_I_PX_CHECK_DURATION: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED && sv->check.status >= HCHK_STATUS_CHECKED) metric = mkf_u64(FN_DURATION, MAX(sv->check.duration, 0)); break; - case ST_F_CHECK_DESC: + case ST_I_PX_CHECK_DESC: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_str(FN_OUTPUT, get_check_status_description(sv->check.status)); break; - case ST_F_LAST_CHK: + case ST_I_PX_LAST_CHK: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_str(FN_OUTPUT, sv->check.desc); break; - case ST_F_CHECK_RISE: + case ST_I_PX_CHECK_RISE: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_u32(FO_CONFIG|FS_SERVICE, ref->check.rise); break; - case ST_F_CHECK_FALL: + case ST_I_PX_CHECK_FALL: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_u32(FO_CONFIG|FS_SERVICE, ref->check.fall); break; - case ST_F_CHECK_HEALTH: + case ST_I_PX_CHECK_HEALTH: if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_u32(FO_CONFIG|FS_SERVICE, ref->check.health); break; - case ST_F_AGENT_STATUS: + case ST_I_PX_AGENT_STATUS: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) { const char *fld_chksts; @@ -1379,101 +1379,101 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, metric = mkf_str(FN_OUTPUT, fld_chksts); } break; - case ST_F_AGENT_CODE: + case ST_I_PX_AGENT_CODE: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED && (sv->agent.status >= HCHK_STATUS_L57DATA)) metric = mkf_u32(FN_OUTPUT, sv->agent.code); break; - case ST_F_AGENT_DURATION: + case ST_I_PX_AGENT_DURATION: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_u64(FN_DURATION, sv->agent.duration); break; - case ST_F_AGENT_DESC: + case ST_I_PX_AGENT_DESC: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_str(FN_OUTPUT, get_check_status_description(sv->agent.status)); break; - case ST_F_LAST_AGT: + case ST_I_PX_LAST_AGT: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_str(FN_OUTPUT, sv->agent.desc); break; - case ST_F_AGENT_RISE: + case ST_I_PX_AGENT_RISE: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_u32(FO_CONFIG|FS_SERVICE, sv->agent.rise); break; - case ST_F_AGENT_FALL: + case ST_I_PX_AGENT_FALL: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_u32(FO_CONFIG|FS_SERVICE, sv->agent.fall); break; - case ST_F_AGENT_HEALTH: + case ST_I_PX_AGENT_HEALTH: if ((sv->agent.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) metric = mkf_u32(FO_CONFIG|FS_SERVICE, sv->agent.health); break; - case ST_F_REQ_TOT: + case ST_I_PX_REQ_TOT: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, sv->counters.p.http.cum_req); break; - case ST_F_HRSP_1XX: + case ST_I_PX_HRSP_1XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[1]); break; - case ST_F_HRSP_2XX: + case ST_I_PX_HRSP_2XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[2]); break; - case ST_F_HRSP_3XX: + case ST_I_PX_HRSP_3XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[3]); break; - case ST_F_HRSP_4XX: + case ST_I_PX_HRSP_4XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[4]); break; - case ST_F_HRSP_5XX: + case ST_I_PX_HRSP_5XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[5]); break; - case ST_F_HRSP_OTHER: + case ST_I_PX_HRSP_OTHER: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[0]); break; - case ST_F_HANAFAIL: + case ST_I_PX_HANAFAIL: if (ref->observe) metric = mkf_u64(FN_COUNTER, sv->counters.failed_hana); break; - case ST_F_CLI_ABRT: + case ST_I_PX_CLI_ABRT: metric = mkf_u64(FN_COUNTER, sv->counters.cli_aborts); break; - case ST_F_SRV_ABRT: + case ST_I_PX_SRV_ABRT: metric = mkf_u64(FN_COUNTER, sv->counters.srv_aborts); break; - case ST_F_LASTSESS: + case ST_I_PX_LASTSESS: metric = mkf_s32(FN_AGE, srv_lastsession(sv)); break; - case ST_F_QTIME: + case ST_I_PX_QTIME: metric = mkf_u32(FN_AVG, swrate_avg(sv->counters.q_time, srv_samples_window)); break; - case ST_F_CTIME: + case ST_I_PX_CTIME: metric = mkf_u32(FN_AVG, swrate_avg(sv->counters.c_time, srv_samples_window)); break; - case ST_F_RTIME: + case ST_I_PX_RTIME: metric = mkf_u32(FN_AVG, swrate_avg(sv->counters.d_time, srv_samples_window)); break; - case ST_F_TTIME: + case ST_I_PX_TTIME: metric = mkf_u32(FN_AVG, swrate_avg(sv->counters.t_time, srv_samples_window)); break; - case ST_F_QT_MAX: + case ST_I_PX_QT_MAX: metric = mkf_u32(FN_MAX, sv->counters.qtime_max); break; - case ST_F_CT_MAX: + case ST_I_PX_CT_MAX: metric = mkf_u32(FN_MAX, sv->counters.ctime_max); break; - case ST_F_RT_MAX: + case ST_I_PX_RT_MAX: metric = mkf_u32(FN_MAX, sv->counters.dtime_max); break; - case ST_F_TT_MAX: + case ST_I_PX_TT_MAX: metric = mkf_u32(FN_MAX, sv->counters.ttime_max); break; - case ST_F_ADDR: + case ST_I_PX_ADDR: if (flags & STAT_SHLGNDS) { switch (addr_to_str(&sv->addr, str, sizeof(str))) { case AF_INET: @@ -1496,7 +1496,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, } } break; - case ST_F_COOKIE: + case ST_I_PX_COOKIE: if (flags & STAT_SHLGNDS && sv->cookie) metric = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, sv->cookie); break; @@ -1526,12 +1526,12 @@ static int stats_dump_sv_stats(struct stconn *sc, struct proxy *px, struct serve struct show_stat_ctx *ctx = appctx->svcctx; struct stats_module *mod; struct field *stats = stat_l[STATS_DOMAIN_PROXY]; - size_t stats_count = ST_F_TOTAL_FIELDS; + size_t stats_count = ST_I_PX_MAX; memset(stats, 0, sizeof(struct field) * stat_count[STATS_DOMAIN_PROXY]); if (!stats_fill_sv_stats(px, sv, ctx->flags, stats, - ST_F_TOTAL_FIELDS, NULL)) + ST_I_PX_MAX, NULL)) return 0; list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { @@ -1585,7 +1585,7 @@ static void stats_fill_be_stats_computesrv(struct proxy *px, int *nbup, int *nbs /* Fill with the backend statistics. is preallocated array of * length . If is != NULL, only fill this one. The length - * of the array must be at least ST_F_TOTAL_FIELDS. If this length is less than + * of the array must be at least ST_I_PX_MAX. If this length is less than * this value, or if the selected field is not implemented for backends, the * function returns 0, otherwise, it returns 1. can take the value * STAT_SHLGNDS. @@ -1600,236 +1600,236 @@ int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int le int nbup, nbsrv, totuw; char *fld; - if (len < ST_F_TOTAL_FIELDS) + if (len < ST_I_PX_MAX) return 0; nbup = nbsrv = totuw = 0; /* some srv values compute for later if we either select all fields or * need them for one of the mentioned ones */ - if (selected_field == NULL || *selected_field == ST_F_STATUS || - *selected_field == ST_F_UWEIGHT) + if (selected_field == NULL || *selected_field == ST_I_PX_STATUS || + *selected_field == ST_I_PX_UWEIGHT) stats_fill_be_stats_computesrv(px, &nbup, &nbsrv, &totuw); /* same here but specific to time fields */ - if (selected_field == NULL || *selected_field == ST_F_QTIME || - *selected_field == ST_F_CTIME || *selected_field == ST_F_RTIME || - *selected_field == ST_F_TTIME) { + if (selected_field == NULL || *selected_field == ST_I_PX_QTIME || + *selected_field == ST_I_PX_CTIME || *selected_field == ST_I_PX_RTIME || + *selected_field == ST_I_PX_TTIME) { be_samples_counter = (px->mode == PR_MODE_HTTP) ? px->be_counters.p.http.cum_req : px->be_counters.cum_lbconn; if (be_samples_counter < TIME_STATS_SAMPLES && be_samples_counter > 0) be_samples_window = be_samples_counter; } - for (; current_field < ST_F_TOTAL_FIELDS; current_field++) { + for (; current_field < ST_I_PX_MAX; current_field++) { struct field metric = { 0 }; switch (current_field) { - case ST_F_PXNAME: + case ST_I_PX_PXNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, px->id); break; - case ST_F_SVNAME: + case ST_I_PX_SVNAME: metric = mkf_str(FO_KEY|FN_NAME|FS_SERVICE, "BACKEND"); break; - case ST_F_MODE: + case ST_I_PX_MODE: metric = mkf_str(FO_CONFIG|FS_SERVICE, proxy_mode_str(px->mode)); break; - case ST_F_QCUR: + case ST_I_PX_QCUR: metric = mkf_u32(0, px->queue.length); break; - case ST_F_QMAX: + case ST_I_PX_QMAX: metric = mkf_u32(FN_MAX, px->be_counters.nbpend_max); break; - case ST_F_SCUR: + case ST_I_PX_SCUR: metric = mkf_u32(0, px->beconn); break; - case ST_F_SMAX: + case ST_I_PX_SMAX: metric = mkf_u32(FN_MAX, px->be_counters.conn_max); break; - case ST_F_SLIM: + case ST_I_PX_SLIM: metric = mkf_u32(FO_CONFIG|FN_LIMIT, px->fullconn); break; - case ST_F_STOT: + case ST_I_PX_STOT: metric = mkf_u64(FN_COUNTER, px->be_counters.cum_sess); break; - case ST_F_BIN: + case ST_I_PX_BIN: metric = mkf_u64(FN_COUNTER, px->be_counters.bytes_in); break; - case ST_F_BOUT: + case ST_I_PX_BOUT: metric = mkf_u64(FN_COUNTER, px->be_counters.bytes_out); break; - case ST_F_DREQ: + case ST_I_PX_DREQ: metric = mkf_u64(FN_COUNTER, px->be_counters.denied_req); break; - case ST_F_DRESP: + case ST_I_PX_DRESP: metric = mkf_u64(FN_COUNTER, px->be_counters.denied_resp); break; - case ST_F_ECON: + case ST_I_PX_ECON: metric = mkf_u64(FN_COUNTER, px->be_counters.failed_conns); break; - case ST_F_ERESP: + case ST_I_PX_ERESP: metric = mkf_u64(FN_COUNTER, px->be_counters.failed_resp); break; - case ST_F_WRETR: + case ST_I_PX_WRETR: metric = mkf_u64(FN_COUNTER, px->be_counters.retries); break; - case ST_F_WREDIS: + case ST_I_PX_WREDIS: metric = mkf_u64(FN_COUNTER, px->be_counters.redispatches); break; - case ST_F_WREW: + case ST_I_PX_WREW: metric = mkf_u64(FN_COUNTER, px->be_counters.failed_rewrites); break; - case ST_F_EINT: + case ST_I_PX_EINT: metric = mkf_u64(FN_COUNTER, px->be_counters.internal_errors); break; - case ST_F_CONNECT: + case ST_I_PX_CONNECT: metric = mkf_u64(FN_COUNTER, px->be_counters.connect); break; - case ST_F_REUSE: + case ST_I_PX_REUSE: metric = mkf_u64(FN_COUNTER, px->be_counters.reuse); break; - case ST_F_STATUS: + case ST_I_PX_STATUS: fld = chunk_newstr(out); chunk_appendf(out, "%s", (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN"); if (flags & (STAT_HIDE_MAINT|STAT_HIDE_DOWN)) chunk_appendf(out, " (%d/%d)", nbup, nbsrv); metric = mkf_str(FO_STATUS, fld); break; - case ST_F_AGG_SRV_CHECK_STATUS: // DEPRECATED - case ST_F_AGG_SRV_STATUS: + case ST_I_PX_AGG_SRV_CHECK_STATUS: // DEPRECATED + case ST_I_PX_AGG_SRV_STATUS: metric = mkf_u32(FN_GAUGE, 0); break; - case ST_F_AGG_CHECK_STATUS: + case ST_I_PX_AGG_CHECK_STATUS: metric = mkf_u32(FN_GAUGE, 0); break; - case ST_F_WEIGHT: + case ST_I_PX_WEIGHT: metric = mkf_u32(FN_AVG, (px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv); break; - case ST_F_UWEIGHT: + case ST_I_PX_UWEIGHT: metric = mkf_u32(FN_AVG, totuw); break; - case ST_F_ACT: + case ST_I_PX_ACT: metric = mkf_u32(0, px->srv_act); break; - case ST_F_BCK: + case ST_I_PX_BCK: metric = mkf_u32(0, px->srv_bck); break; - case ST_F_CHKDOWN: + case ST_I_PX_CHKDOWN: metric = mkf_u64(FN_COUNTER, px->be_counters.down_trans); break; - case ST_F_LASTCHG: + case ST_I_PX_LASTCHG: metric = mkf_u32(FN_AGE, ns_to_sec(now_ns) - px->last_change); break; - case ST_F_DOWNTIME: + case ST_I_PX_DOWNTIME: if (px->srv) metric = mkf_u32(FN_COUNTER, be_downtime(px)); break; - case ST_F_PID: + case ST_I_PX_PID: metric = mkf_u32(FO_KEY, 1); break; - case ST_F_IID: + case ST_I_PX_IID: metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid); break; - case ST_F_SID: + case ST_I_PX_SID: metric = mkf_u32(FO_KEY|FS_SERVICE, 0); break; - case ST_F_LBTOT: + case ST_I_PX_LBTOT: metric = mkf_u64(FN_COUNTER, px->be_counters.cum_lbconn); break; - case ST_F_TYPE: + case ST_I_PX_TYPE: metric = mkf_u32(FO_CONFIG|FS_SERVICE, STATS_TYPE_BE); break; - case ST_F_RATE: + case ST_I_PX_RATE: metric = mkf_u32(0, read_freq_ctr(&px->be_sess_per_sec)); break; - case ST_F_RATE_MAX: + case ST_I_PX_RATE_MAX: metric = mkf_u32(0, px->be_counters.sps_max); break; - case ST_F_COOKIE: + case ST_I_PX_COOKIE: if (flags & STAT_SHLGNDS && px->cookie_name) metric = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, px->cookie_name); break; - case ST_F_ALGO: + case ST_I_PX_ALGO: if (flags & STAT_SHLGNDS) metric = mkf_str(FO_CONFIG|FS_SERVICE, backend_lb_algo_str(px->lbprm.algo & BE_LB_ALGO)); break; - case ST_F_REQ_TOT: + case ST_I_PX_REQ_TOT: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.cum_req); break; - case ST_F_HRSP_1XX: + case ST_I_PX_HRSP_1XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[1]); break; - case ST_F_HRSP_2XX: + case ST_I_PX_HRSP_2XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[2]); break; - case ST_F_HRSP_3XX: + case ST_I_PX_HRSP_3XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[3]); break; - case ST_F_HRSP_4XX: + case ST_I_PX_HRSP_4XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[4]); break; - case ST_F_HRSP_5XX: + case ST_I_PX_HRSP_5XX: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[5]); break; - case ST_F_HRSP_OTHER: + case ST_I_PX_HRSP_OTHER: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[0]); break; - case ST_F_CACHE_LOOKUPS: + case ST_I_PX_CACHE_LOOKUPS: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.cache_lookups); break; - case ST_F_CACHE_HITS: + case ST_I_PX_CACHE_HITS: if (px->mode == PR_MODE_HTTP) metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.cache_hits); break; - case ST_F_CLI_ABRT: + case ST_I_PX_CLI_ABRT: metric = mkf_u64(FN_COUNTER, px->be_counters.cli_aborts); break; - case ST_F_SRV_ABRT: + case ST_I_PX_SRV_ABRT: metric = mkf_u64(FN_COUNTER, px->be_counters.srv_aborts); break; - case ST_F_COMP_IN: + case ST_I_PX_COMP_IN: metric = mkf_u64(FN_COUNTER, px->be_counters.comp_in[COMP_DIR_RES]); break; - case ST_F_COMP_OUT: + case ST_I_PX_COMP_OUT: metric = mkf_u64(FN_COUNTER, px->be_counters.comp_out[COMP_DIR_RES]); break; - case ST_F_COMP_BYP: + case ST_I_PX_COMP_BYP: metric = mkf_u64(FN_COUNTER, px->be_counters.comp_byp[COMP_DIR_RES]); break; - case ST_F_COMP_RSP: + case ST_I_PX_COMP_RSP: metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.comp_rsp); break; - case ST_F_LASTSESS: + case ST_I_PX_LASTSESS: metric = mkf_s32(FN_AGE, be_lastsession(px)); break; - case ST_F_QTIME: + case ST_I_PX_QTIME: metric = mkf_u32(FN_AVG, swrate_avg(px->be_counters.q_time, be_samples_window)); break; - case ST_F_CTIME: + case ST_I_PX_CTIME: metric = mkf_u32(FN_AVG, swrate_avg(px->be_counters.c_time, be_samples_window)); break; - case ST_F_RTIME: + case ST_I_PX_RTIME: metric = mkf_u32(FN_AVG, swrate_avg(px->be_counters.d_time, be_samples_window)); break; - case ST_F_TTIME: + case ST_I_PX_TTIME: metric = mkf_u32(FN_AVG, swrate_avg(px->be_counters.t_time, be_samples_window)); break; - case ST_F_QT_MAX: + case ST_I_PX_QT_MAX: metric = mkf_u32(FN_MAX, px->be_counters.qtime_max); break; - case ST_F_CT_MAX: + case ST_I_PX_CT_MAX: metric = mkf_u32(FN_MAX, px->be_counters.ctime_max); break; - case ST_F_RT_MAX: + case ST_I_PX_RT_MAX: metric = mkf_u32(FN_MAX, px->be_counters.dtime_max); break; - case ST_F_TT_MAX: + case ST_I_PX_TT_MAX: metric = mkf_u32(FN_MAX, px->be_counters.ttime_max); break; default: @@ -1857,7 +1857,7 @@ static int stats_dump_be_stats(struct stconn *sc, struct proxy *px) struct show_stat_ctx *ctx = appctx->svcctx; struct field *stats = stat_l[STATS_DOMAIN_PROXY]; struct stats_module *mod; - size_t stats_count = ST_F_TOTAL_FIELDS; + size_t stats_count = ST_I_PX_MAX; if (!(px->cap & PR_CAP_BE)) return 0; @@ -1867,7 +1867,7 @@ static int stats_dump_be_stats(struct stconn *sc, struct proxy *px) memset(stats, 0, sizeof(struct field) * stat_count[STATS_DOMAIN_PROXY]); - if (!stats_fill_be_stats(px, ctx->flags, stats, ST_F_TOTAL_FIELDS, NULL)) + if (!stats_fill_be_stats(px, ctx->flags, stats, ST_I_PX_MAX, NULL)) return 0; list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { @@ -2819,11 +2819,11 @@ void stats_register_module(struct stats_module *m) static int allocate_stats_px_postcheck(void) { struct stats_module *mod; - size_t i = ST_F_TOTAL_FIELDS; + size_t i = ST_I_PX_MAX; int err_code = 0; struct proxy *px; - stat_count[STATS_DOMAIN_PROXY] += ST_F_TOTAL_FIELDS; + stat_count[STATS_DOMAIN_PROXY] += ST_I_PX_MAX; stat_f[STATS_DOMAIN_PROXY] = malloc(stat_count[STATS_DOMAIN_PROXY] * sizeof(struct name_desc)); if (!stat_f[STATS_DOMAIN_PROXY]) { @@ -2832,8 +2832,8 @@ static int allocate_stats_px_postcheck(void) return err_code; } - memcpy(stat_f[STATS_DOMAIN_PROXY], stat_fields, - ST_F_TOTAL_FIELDS * sizeof(struct name_desc)); + memcpy(stat_f[STATS_DOMAIN_PROXY], metrics_px, + ST_I_PX_MAX * sizeof(struct name_desc)); list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { memcpy(stat_f[STATS_DOMAIN_PROXY] + i,