MINOR: resolvers: rework dns stats prototype because specific to resolvers

Counters are currently stored into lowlevel nameservers struct but
most of them are resolving layer data and increased in the upper layer
So this patch renames the prototype used to allocate/dump them with prefix
'resolv' waiting for a clean split.
This commit is contained in:
Emeric Brun 2021-01-06 16:01:02 +01:00 committed by Willy Tarreau
parent 6a2006ae37
commit d3b4495f0d
3 changed files with 19 additions and 19 deletions

View File

@ -48,10 +48,10 @@ void resolv_trigger_resolution(struct resolv_requester *requester);
enum act_parse_ret resolv_parse_do_resolve(const char **args, int *orig_arg, struct proxy *px, struct act_rule *rule, char **err);
int check_action_do_resolve(struct act_rule *rule, struct proxy *px, char **err);
int stats_dump_dns(struct stream_interface *si,
struct field *stats, size_t stats_count,
struct list *stat_modules);
void dns_stats_clear_counters(int clrall, struct list *stat_modules);
int dns_allocate_counters(struct list *stat_modules);
int stats_dump_resolvers(struct stream_interface *si,
struct field *stats, size_t stats_count,
struct list *stat_modules);
void resolv_stats_clear_counters(int clrall, struct list *stat_modules);
int resolv_allocate_counters(struct list *stat_modules);
#endif // _HAPROXY_DNS_H

View File

@ -2379,7 +2379,7 @@ static int resolvers_finalize_config(void)
}
static int stats_dump_dns_to_buffer(struct stream_interface *si,
static int stats_dump_resolv_to_buffer(struct stream_interface *si,
struct dns_nameserver *ns,
struct field *stats, size_t stats_count,
struct list *stat_modules)
@ -2414,9 +2414,9 @@ static int stats_dump_dns_to_buffer(struct stream_interface *si,
/* Uses <appctx.ctx.stats.obj1> as a pointer to the current resolver and <obj2>
* as a pointer to the current nameserver.
*/
int stats_dump_dns(struct stream_interface *si,
struct field *stats, size_t stats_count,
struct list *stat_modules)
int stats_dump_resolvers(struct stream_interface *si,
struct field *stats, size_t stats_count,
struct list *stat_modules)
{
struct appctx *appctx = __objt_appctx(si->end);
struct channel *rep = si_ic(si);
@ -2440,9 +2440,9 @@ int stats_dump_dns(struct stream_interface *si,
if (buffer_almost_full(&rep->buf))
goto full;
if (!stats_dump_dns_to_buffer(si, ns,
stats, stats_count,
stat_modules)) {
if (!stats_dump_resolv_to_buffer(si, ns,
stats, stats_count,
stat_modules)) {
return 0;
}
}
@ -2457,7 +2457,7 @@ int stats_dump_dns(struct stream_interface *si,
return 0;
}
void dns_stats_clear_counters(int clrall, struct list *stat_modules)
void resolv_stats_clear_counters(int clrall, struct list *stat_modules)
{
struct resolvers *resolvers;
struct dns_nameserver *ns;
@ -2478,7 +2478,7 @@ void dns_stats_clear_counters(int clrall, struct list *stat_modules)
}
int dns_allocate_counters(struct list *stat_modules)
int resolv_allocate_counters(struct list *stat_modules)
{
struct stats_module *mod;
struct resolvers *resolvers;

View File

@ -3580,9 +3580,9 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct htx *ht
case STAT_ST_LIST:
switch (domain) {
case STATS_DOMAIN_DNS:
if (!stats_dump_dns(si, stat_l[domain],
stat_count[domain],
&stats_module_list[domain])) {
if (!stats_dump_resolvers(si, stat_l[domain],
stat_count[domain],
&stats_module_list[domain])) {
return 0;
}
break;
@ -4691,7 +4691,7 @@ static int cli_parse_clear_counters(char **args, char *payload, struct appctx *a
}
}
dns_stats_clear_counters(clrall, &stats_module_list[STATS_DOMAIN_DNS]);
resolv_stats_clear_counters(clrall, &stats_module_list[STATS_DOMAIN_DNS]);
memset(activity, 0, sizeof(activity));
return 1;
@ -4940,7 +4940,7 @@ static int allocate_stats_dns_postcheck(void)
i += mod->stats_count;
}
if (!dns_allocate_counters(&stats_module_list[STATS_DOMAIN_DNS])) {
if (!resolv_allocate_counters(&stats_module_list[STATS_DOMAIN_DNS])) {
ha_alert("stats: cannot allocate all counters for dns statistics\n");
err_code |= ERR_ALERT | ERR_FATAL;
return err_code;