mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-18 09:24:31 +00:00
BUG/MINOR: promex: Skip resolvers metrics when there is no resolver section
By default, there is always at least on resolver section, the default one, based on "/etc/resolv.conf" content. However, it is possible to have no resolver at all if the file is empty or if any error occurred. Errors are silently ignored at this stage. In that case, there was a bug in the Prometheus exporter leading to a crash because the resolver section list is empty. An invalid resolver entity was used. To fix the issue we must only take care to not dump resolvers metrics when there is no resolver. Thanks to Aurelien to have spotted the offending commit. This patch should fix the issue #2604. It must be backported to 3.0. (cherry picked from commit 91fe085943cea52d0c3d04e81f8ecb6a51668b09) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
parent
abecd956e5
commit
ebd0e8f699
@ -3919,8 +3919,12 @@ static int rslv_promex_metric_info(unsigned int id, struct promex_metric *metric
|
||||
|
||||
static void *rslv_promex_start_ts(void *unused, unsigned int id)
|
||||
{
|
||||
struct resolvers *resolver = LIST_NEXT(&sec_resolvers, struct resolvers *, list);
|
||||
struct resolvers *resolver;
|
||||
|
||||
if (LIST_ISEMPTY(&sec_resolvers))
|
||||
return NULL;
|
||||
|
||||
resolver = LIST_NEXT(&sec_resolvers, struct resolvers *, list);
|
||||
return LIST_NEXT(&resolver->nameservers, struct dns_nameserver *, list);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user