mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-19 13:38:44 +02:00
MINOR: dns/stats: integrate dns counters in stats
Use the new stats module API to integrate the dns counters in the standard stats. This is done in order to avoid code duplication, keep the code related to cli out of dns and use the full possibility of the stats function, allowing to print dns stats in csv or json format.
This commit is contained in:
committed by
Christopher Faulet
parent
0b70a8a314
commit
fbd0bc98fe
@@ -27,6 +27,7 @@
|
||||
#include <haproxy/connection-t.h>
|
||||
#include <haproxy/dgram-t.h>
|
||||
#include <haproxy/obj_type-t.h>
|
||||
#include <haproxy/stats-t.h>
|
||||
#include <haproxy/task-t.h>
|
||||
#include <haproxy/thread.h>
|
||||
|
||||
@@ -210,26 +211,31 @@ struct dns_nameserver {
|
||||
struct dgram_conn *dgram; /* transport layer */
|
||||
struct sockaddr_storage addr; /* IP address */
|
||||
|
||||
struct { /* numbers relted to this name server: */
|
||||
long long sent; /* - queries sent */
|
||||
long long snd_error; /* - sending errors */
|
||||
long long valid; /* - valid response */
|
||||
long long update; /* - valid response used to update server's IP */
|
||||
long long cname; /* - CNAME response requiring new resolution */
|
||||
long long cname_error; /* - error when resolving CNAMEs */
|
||||
long long any_err; /* - void response (usually because ANY qtype) */
|
||||
long long nx; /* - NX response */
|
||||
long long timeout; /* - queries which reached timeout */
|
||||
long long refused; /* - queries refused */
|
||||
long long other; /* - other type of response */
|
||||
long long invalid; /* - malformed DNS response */
|
||||
long long too_big; /* - too big response */
|
||||
long long outdated; /* - outdated response (server slower than the other ones) */
|
||||
long long truncated; /* - truncated response */
|
||||
} counters;
|
||||
EXTRA_COUNTERS(extra_counters);
|
||||
struct dns_counters *counters;
|
||||
|
||||
struct list list; /* nameserver chained list */
|
||||
};
|
||||
|
||||
struct dns_counters {
|
||||
char *id;
|
||||
long long sent; /* - queries sent */
|
||||
long long snd_error; /* - sending errors */
|
||||
long long valid; /* - valid response */
|
||||
long long update; /* - valid response used to update server's IP */
|
||||
long long cname; /* - CNAME response requiring new resolution */
|
||||
long long cname_error; /* - error when resolving CNAMEs */
|
||||
long long any_err; /* - void response (usually because ANY qtype) */
|
||||
long long nx; /* - NX response */
|
||||
long long timeout; /* - queries which reached timeout */
|
||||
long long refused; /* - queries refused */
|
||||
long long other; /* - other type of response */
|
||||
long long invalid; /* - malformed DNS response */
|
||||
long long too_big; /* - too big response */
|
||||
long long outdated; /* - outdated response (server slower than the other ones) */
|
||||
long long truncated; /* - truncated response */;
|
||||
};
|
||||
|
||||
struct dns_options {
|
||||
int family_prio; /* which IP family should the resolver use when both are returned */
|
||||
struct {
|
||||
|
||||
@@ -48,5 +48,10 @@ void dns_trigger_resolution(struct dns_requester *requester);
|
||||
enum act_parse_ret dns_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);
|
||||
|
||||
#endif // _HAPROXY_DNS_H
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#define STATS_TYPE_SV 2
|
||||
#define STATS_TYPE_SO 3
|
||||
|
||||
#define STATS_DOMAIN (0) /* used for bitshifting, type of statistics, for now only proxy is available */
|
||||
#define STATS_DOMAIN (0) /* used for bitshifting, type of statistics: proxy or dns */
|
||||
#define STATS_PX_CAP (8) /* used for bitshifting, differentiate obj1 type for proxy statistics */
|
||||
|
||||
/* HTTP stats : applet.st0 */
|
||||
@@ -459,6 +459,7 @@ enum counters_type {
|
||||
COUNTERS_BE,
|
||||
COUNTERS_SV,
|
||||
COUNTERS_LI,
|
||||
COUNTERS_DNS,
|
||||
|
||||
COUNTERS_OFF_END
|
||||
};
|
||||
@@ -490,6 +491,7 @@ struct extra_counters {
|
||||
/* stats_domain is used in a flag as a 1 byte field */
|
||||
enum stats_domain {
|
||||
STATS_DOMAIN_PROXY = 0,
|
||||
STATS_DOMAIN_DNS,
|
||||
STATS_DOMAIN_COUNT,
|
||||
|
||||
STATS_DOMAIN_MASK = 0xff
|
||||
|
||||
Reference in New Issue
Block a user