4243. [func] Improved stats reporting from Timothe Litt. [RT #38941]
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
4243. [func] Improved stats reporting from Timothe Litt. [RT #38941]
|
||||
|
||||
4242. [bug] Replace the client if not already replaced when
|
||||
prefetching. [RT #41001]
|
||||
|
||||
|
||||
+485
-487
File diff suppressed because it is too large
Load Diff
@@ -302,6 +302,12 @@ static char xslmsg[] =
|
||||
" <xsl:value-of select=\"server/current-time\"/>\n"
|
||||
" </td>\n"
|
||||
" </tr>\n"
|
||||
" <tr>\n"
|
||||
" <th>Server version:</th>\n"
|
||||
" <td>\n"
|
||||
" <xsl:value-of select=\"server/version\"/>\n"
|
||||
" </td>\n"
|
||||
" </tr>\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" <xsl:if test=\"server/counters[@type="opcode"]/counter[. > 0]\">\n"
|
||||
|
||||
@@ -2373,6 +2373,7 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view,
|
||||
dns_db_closeversion(db, &version, ISC_TRUE);
|
||||
CHECK(dns_zone_replacedb(zone, db, ISC_FALSE));
|
||||
}
|
||||
dns_zone_setoption2(zone, DNS_ZONEOPT2_AUTOEMPTY, ISC_TRUE);
|
||||
dns_zone_setview(zone, view);
|
||||
CHECK(dns_view_addzone(view, zone));
|
||||
|
||||
|
||||
@@ -80,6 +80,41 @@ static isc_once_t once = ISC_ONCE_INIT;
|
||||
#undef EXTENDED_STATS
|
||||
#endif
|
||||
|
||||
#ifdef EXTENDED_STATS
|
||||
static const char *
|
||||
user_zonetype( dns_zone_t *zone ) {
|
||||
dns_zonetype_t ztype;
|
||||
dns_view_t *view;
|
||||
static const struct zt {
|
||||
const dns_zonetype_t type;
|
||||
const char *const string;
|
||||
} typemap[] = {
|
||||
{ dns_zone_none, "none" },
|
||||
{ dns_zone_master, "master" },
|
||||
{ dns_zone_slave, "slave" },
|
||||
{ dns_zone_stub, "stub" },
|
||||
{ dns_zone_staticstub, "static-stub" },
|
||||
{ dns_zone_key, "key" },
|
||||
{ dns_zone_dlz, "dlz" },
|
||||
{ dns_zone_redirect, "redirect" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct zt *tp;
|
||||
|
||||
if ((dns_zone_getoptions2(zone) & DNS_ZONEOPT2_AUTOEMPTY) != 0)
|
||||
return ("builtin");
|
||||
|
||||
view = dns_zone_getview(zone);
|
||||
if (view != NULL && strcmp(view->name, "_bind") == 0)
|
||||
return ("builtin");
|
||||
|
||||
ztype = dns_zone_gettype(zone);
|
||||
for (tp = typemap; tp->string != NULL && tp->type != ztype; tp++)
|
||||
/* empty */;
|
||||
return (tp->string);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*%
|
||||
* Statistics descriptions. These could be statistically initialized at
|
||||
* compile time, but we configure them run time in the init_desc() function
|
||||
@@ -1296,6 +1331,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
|
||||
isc_uint64_t nsstat_values[dns_nsstatscounter_max];
|
||||
int xmlrc;
|
||||
stats_dumparg_t dumparg;
|
||||
const char *ztype;
|
||||
|
||||
statlevel = dns_zone_getstatlevel(zone);
|
||||
if (statlevel == dns_zonestat_none)
|
||||
@@ -1315,6 +1351,14 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
|
||||
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "rdataclass",
|
||||
ISC_XMLCHAR buf));
|
||||
|
||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "type"));
|
||||
ztype = user_zonetype(zone);
|
||||
if (ztype != NULL)
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR ztype));
|
||||
else
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR "unknown"));
|
||||
TRY0(xmlTextWriterEndElement(writer)); /* type */
|
||||
|
||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "serial"));
|
||||
if (dns_zone_getserial2(zone, &serial) == ISC_R_SUCCESS)
|
||||
TRY0(xmlTextWriterWriteFormatString(writer, "%u", serial));
|
||||
@@ -1418,6 +1462,9 @@ generatexml(ns_server_t *server, isc_uint32_t flags,
|
||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "current-time"));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR nowstr));
|
||||
TRY0(xmlTextWriterEndElement(writer)); /* current-time */
|
||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "version"));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR ns_g_version));
|
||||
TRY0(xmlTextWriterEndElement(writer)); /* version */
|
||||
|
||||
if ((flags & STATS_XML_SERVER) != 0) {
|
||||
dumparg.result = ISC_R_SUCCESS;
|
||||
@@ -1896,8 +1943,8 @@ wrap_jsonfree(isc_buffer_t *buffer, void *arg) {
|
||||
}
|
||||
|
||||
static json_object *
|
||||
addzone(char *name, char *class, isc_uint32_t serial,
|
||||
isc_boolean_t add_serial)
|
||||
addzone(char *name, char *class, const char *ztype,
|
||||
isc_uint32_t serial, isc_boolean_t add_serial)
|
||||
{
|
||||
json_object *node = json_object_new_object();
|
||||
|
||||
@@ -1909,6 +1956,9 @@ addzone(char *name, char *class, isc_uint32_t serial,
|
||||
if (add_serial)
|
||||
json_object_object_add(node, "serial",
|
||||
json_object_new_int64(serial));
|
||||
if (ztype != NULL)
|
||||
json_object_object_add(node, "type",
|
||||
json_object_new_string(ztype));
|
||||
return (node);
|
||||
}
|
||||
|
||||
@@ -1940,9 +1990,11 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
|
||||
class_only = class;
|
||||
|
||||
if (dns_zone_getserial2(zone, &serial) != ISC_R_SUCCESS)
|
||||
zoneobj = addzone(zone_name_only, class_only, 0, ISC_FALSE);
|
||||
zoneobj = addzone(zone_name_only, class_only,
|
||||
user_zonetype(zone), 0, ISC_FALSE);
|
||||
else
|
||||
zoneobj = addzone(zone_name_only, class_only, serial, ISC_TRUE);
|
||||
zoneobj = addzone(zone_name_only, class_only,
|
||||
user_zonetype(zone), serial, ISC_TRUE);
|
||||
|
||||
if (zoneobj == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
@@ -2057,6 +2109,9 @@ generatejson(ns_server_t *server, size_t *msglen,
|
||||
obj = json_object_new_string(nowstr);
|
||||
CHECKMEM(obj);
|
||||
json_object_object_add(bindstats, "current-time", obj);
|
||||
obj = json_object_new_string(ns_g_version);
|
||||
CHECKMEM(obj);
|
||||
json_object_object_add(bindstats, "version", obj);
|
||||
|
||||
if ((flags & STATS_JSON_SERVER) != 0) {
|
||||
/* OPCODE counters */
|
||||
@@ -2466,7 +2521,7 @@ render_json(isc_uint32_t flags,
|
||||
json_object *bindstats = NULL;
|
||||
ns_server_t *server = arg;
|
||||
const char *msg = NULL;
|
||||
size_t msglen;
|
||||
size_t msglen = 0;
|
||||
char *p;
|
||||
|
||||
UNUSED(url);
|
||||
|
||||
@@ -130,5 +130,17 @@ fi
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
ret=0
|
||||
n=`expr $n + 1`
|
||||
echo "I:checking that zones return their type ($n)"
|
||||
if ./xmlstats && [ -x ${CURL} ] ; then
|
||||
${CURL} http://10.53.0.1:8053/xml/v3/zones > curl.out.${t} 2>/dev/null || ret=1
|
||||
grep '<zone name="32/1.0.0.127-in-addr.example" rdataclass="IN"><type>master</type>' curl.out.${t} > /dev/null || ret=1
|
||||
else
|
||||
echo "I:skipping test as libxml2 and/or curl was not found"
|
||||
fi
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo "I:exit status: $status"
|
||||
exit $status
|
||||
|
||||
@@ -93,7 +93,8 @@ typedef enum {
|
||||
* The following zone options are shifted left into the
|
||||
* higher-order 32 bits of the options.
|
||||
*/
|
||||
#define DNS_ZONEOPT2_CHECKTTL 0x00000001 /*%< check max-zone-ttl */
|
||||
#define DNS_ZONEOPT2_CHECKTTL 0x00000001U /*%< check max-zone-ttl */
|
||||
#define DNS_ZONEOPT2_AUTOEMPTY 0x00000002U /*%< automatic empty zone */
|
||||
|
||||
#ifndef NOMINUM_PUBLIC
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user