Commit afbe6d8a authored by Vladimír Čunát's avatar Vladimír Čunát Committed by Petr Špaček

stats: remove tracking of expiring records

The predict module doesn't use this way since 965bab92 (v1.3.2),
and there seems to be no other likely use case.
parent eeb6c24f
......@@ -3,6 +3,7 @@ Knot Resolver 2.X.Y (2018-0M-DD)
Incompatible changes
--------------------
- stats: remove tracking of expiring records (predict uses another way)
- systemd: more chages in default unit files (TODO)
- ta_sentinel: implement protocol draft-ietf-dnsop-kskroll-sentinel-01
(our draft-ietf-dnsop-kskroll-sentinel-00 implementation had inverted logic)
......@@ -15,6 +16,7 @@ Bugfixes
- cache: fix broken refresh of insecure records that were about to expire
- fix the hints module on some systems, e.g. Fedora (came back on 2.0.0)
- build with older gnutls (conditionally disable features)
- fix the predict module to work with insecure records & cleanup code
Knot Resolver 2.0.0 (2018-01-31)
......
......@@ -86,14 +86,6 @@ and include subrequests. The list maximum size is 5000 entries, make diffs if yo
Clear the list of most frequent iterative queries.
.. function:: stats.expiring()
Outputs list of soon-to-expire records as a JSON array.
The list maximum size is 5000 entries, make diffs if you want to track it over time.
.. function:: stats.clear_expiring()
Clear the list of soon expiring records.
Built-in statistics
^^^^^^^^^^^^^^^^^^^
......
......@@ -84,7 +84,6 @@ struct stat_data {
map_t map;
struct {
namehash_t *frequent;
namehash_t *expiring;
} queries;
struct {
addrlist_t q;
......@@ -124,10 +123,10 @@ static inline int collect_key(char *key, const knot_dname_t *name, uint16_t type
{
memcpy(key, &type, sizeof(type));
int key_len = knot_dname_to_wire((uint8_t *)key + sizeof(type), name, KNOT_DNAME_MAXLEN);
if (key_len > 0) {
return key_len + sizeof(type);
if (key_len < 0) {
return kr_error(key_len);
}
return key_len;
return key_len + sizeof(type);
}
static void collect_sample(struct stat_data *data, struct kr_rplan *rplan, knot_pkt_t *pkt)
......@@ -135,18 +134,18 @@ static void collect_sample(struct stat_data *data, struct kr_rplan *rplan, knot_
/* Sample key = {[2] type, [1-255] owner} */
char key[sizeof(uint16_t) + KNOT_DNAME_MAXLEN];
for (size_t i = 0; i < rplan->resolved.len; ++i) {
/* Sample queries leading to iteration or expiring */
/* Sample queries leading to iteration */
struct kr_query *qry = rplan->resolved.at[i];
if ((qry->flags.CACHED) && !(qry->flags.EXPIRING)) {
if (qry->flags.CACHED) {
continue;
}
int key_len = collect_key(key, qry->sname, qry->stype);
if (qry->flags.EXPIRING) {
unsigned *count = lru_get_new(data->queries.expiring, key, key_len);
if (count)
*count += 1;
/* Consider 1 in N for frequent sampling. */
} else if (kr_rand_uint(FREQUENT_PSAMPLE) <= 1) {
if (kr_rand_uint(FREQUENT_PSAMPLE) <= 1) {
int key_len = collect_key(key, qry->sname, qry->stype);
if (key_len < 0) {
assert(false);
continue;
}
unsigned *count = lru_get_new(data->queries.frequent, key, key_len);
if (count)
*count += 1;
......@@ -370,19 +369,6 @@ static char* clear_frequent(void *env, struct kr_module *module, const char *arg
return NULL;
}
static char* dump_expiring(void *env, struct kr_module *module, const char *args)
{
struct stat_data *data = module->data;
return dump_list(env, module, args, data->queries.expiring);
}
static char* clear_expiring(void *env, struct kr_module *module, const char *args)
{
struct stat_data *data = module->data;
lru_reset(data->queries.expiring);
return NULL;
}
static char* dump_upstreams(void *env, struct kr_module *module, const char *args)
{
struct stat_data *data = module->data;
......@@ -447,7 +433,6 @@ int stats_init(struct kr_module *module)
data->map = map_make();
module->data = data;
lru_create(&data->queries.frequent, FREQUENT_COUNT, NULL, NULL);
lru_create(&data->queries.expiring, FREQUENT_COUNT, NULL, NULL);
/* Initialize ring buffer of recently visited upstreams */
array_init(data->upstreams.q);
if (array_reserve(data->upstreams.q, UPSTREAMS_COUNT) != 0) {
......@@ -467,7 +452,6 @@ int stats_deinit(struct kr_module *module)
if (data) {
map_clear(&data->map);
lru_free(data->queries.frequent);
lru_free(data->queries.expiring);
array_clear(data->upstreams.q);
free(data);
}
......@@ -483,8 +467,6 @@ struct kr_prop *stats_props(void)
{ &stats_list, "list", "List observed metrics.", },
{ &dump_frequent, "frequent", "List most frequent queries.", },
{ &clear_frequent,"clear_frequent", "Clear frequent queries log.", },
{ &dump_expiring, "expiring", "List expiring records.", },
{ &clear_expiring,"clear_expiring", "Clear expiring records log.", },
{ &dump_upstreams, "upstreams", "List recently seen authoritatives.", },
{ NULL, NULL, NULL }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment