mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
BUG/MINOR: stats: Continue to fill frontend stats on unimplemented metric
A regression was introduced by the commit 0ef54397b
("MEDIUM: stats: allow
to select one field in `stats_fill_fe_stats`"). stats_fill_fe_stats()
function fails on unimplemented metrics for frontends. However, not all
stats metrics are used by frontends. For instance ST_F_QCUR. As a
consequence, the frontends stats are always skipped.
To fix the bug, we just skip unimplemented metric for frontends. An error is
triggered only if a specific field is given and is unimplemented.
No backport is needed except if the above commit is backported.
This commit is contained in:
parent
24c41d55bd
commit
d808f1759d
16
src/stats.c
16
src/stats.c
@ -1623,10 +1623,10 @@ int stats_dump_one_line(const struct field *stats, size_t stats_count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fill <stats> with the frontend statistics. <stats> is preallocated array of
|
/* Fill <stats> with the frontend statistics. <stats> is preallocated array of
|
||||||
* length <len>. The length of the array must be at least ST_F_TOTAL_FIELDS. If
|
* length <len>. If <selected_field> is != NULL, only fill this one. The length
|
||||||
* this length is less than this value, or if one field is not implemented, the
|
* of the array must be at least ST_F_TOTAL_FIELDS. If this length is less than
|
||||||
* function returns 0, otherwise, it returns 1. If selected_field is != NULL,
|
* this value, or if the selected field is not implemented for frontends, the
|
||||||
* only fill this one
|
* function returns 0, otherwise, it returns 1.
|
||||||
*/
|
*/
|
||||||
int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
||||||
enum stat_field *selected_field)
|
enum stat_field *selected_field)
|
||||||
@ -1787,8 +1787,12 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
|||||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.cum_conn);
|
metric = mkf_u64(FN_COUNTER, px->fe_counters.cum_conn);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* should never fall here unless non implemented */
|
/* not used for frontends. If a specific metric
|
||||||
return 0;
|
* is requested, return an error. Otherwise continue.
|
||||||
|
*/
|
||||||
|
if (selected_field != NULL)
|
||||||
|
return 0;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
stats[current_field] = metric;
|
stats[current_field] = metric;
|
||||||
if (selected_field != NULL)
|
if (selected_field != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user