BUG/MEDIUM: promex: Fix dump of extra counters
When extra counters are dumped for an entity (frontend, backend, server or listener), there is a filter on capabilities. Some extra counters are not available for all entities and must be ignored. However, when this was performed, the field number, used as an index to dump the metric value, was still incremented while it should not and leads to an overflow or a stats mix-up. This patch must be backported to 3.0.
This commit is contained in:
parent
e75a019fba
commit
d1adfd9fe4
|
@ -726,11 +726,8 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
|
|||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_FE)) {
|
||||
ctx->field_num += mod->stats_count;
|
||||
ctx->mod_field_num = 0;
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_FE))
|
||||
continue;
|
||||
}
|
||||
|
||||
for (;ctx->mod_field_num < mod->stats_count; ctx->mod_field_num++) {
|
||||
name = ist2(mod->stats[ctx->mod_field_num].name, strlen(mod->stats[ctx->mod_field_num].name));
|
||||
|
@ -898,11 +895,8 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
|
|||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_LI)) {
|
||||
ctx->field_num += mod->stats_count;
|
||||
ctx->mod_field_num = 0;
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_LI))
|
||||
continue;
|
||||
}
|
||||
|
||||
for (;ctx->mod_field_num < mod->stats_count; ctx->mod_field_num++) {
|
||||
name = ist2(mod->stats[ctx->mod_field_num].name, strlen(mod->stats[ctx->mod_field_num].name));
|
||||
|
@ -1179,11 +1173,8 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
|||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_BE)) {
|
||||
ctx->field_num += mod->stats_count;
|
||||
ctx->mod_field_num = 0;
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_BE))
|
||||
continue;
|
||||
}
|
||||
|
||||
for (;ctx->mod_field_num < mod->stats_count; ctx->mod_field_num++) {
|
||||
name = ist2(mod->stats[ctx->mod_field_num].name, strlen(mod->stats[ctx->mod_field_num].name));
|
||||
|
@ -1437,11 +1428,8 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
list_for_each_entry_from(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
void *counters;
|
||||
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_SRV)) {
|
||||
ctx->field_num += mod->stats_count;
|
||||
ctx->mod_field_num = 0;
|
||||
if (!(stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_SRV))
|
||||
continue;
|
||||
}
|
||||
|
||||
for (;ctx->mod_field_num < mod->stats_count; ctx->mod_field_num++) {
|
||||
name = ist2(mod->stats[ctx->mod_field_num].name, strlen(mod->stats[ctx->mod_field_num].name));
|
||||
|
|
Loading…
Reference in New Issue