master
go 1,276 lines 56.2 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package unbound
4
5 import (
6 "bufio"
7 "bytes"
8 "context"
9 "errors"
10 "fmt"
11 "os"
12 "strings"
13 "testing"
14
15 "github.com/stretchr/testify/assert"
16 "github.com/stretchr/testify/require"
17
18 "github.com/netdata/netdata/go/plugins/pkg/tlscfg"
19 "github.com/netdata/netdata/go/plugins/plugin/framework/collectorapi"
20 "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/collecttest"
21 "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/socket"
22 )
23
24 var (
25 dataConfigJSON, _ = os.ReadFile("testdata/config.json")
26 dataConfigYAML, _ = os.ReadFile("testdata/config.yaml")
27
28 dataCommonStats, _ = os.ReadFile("testdata/stats/common.txt")
29 dataExtendedStats, _ = os.ReadFile("testdata/stats/extended.txt")
30 dataLifeCycleCumulative1, _ = os.ReadFile("testdata/stats/lifecycle/cumulative/extended1.txt")
31 dataLifeCycleCumulative2, _ = os.ReadFile("testdata/stats/lifecycle/cumulative/extended2.txt")
32 dataLifeCycleCumulative3, _ = os.ReadFile("testdata/stats/lifecycle/cumulative/extended3.txt")
33 dataLifeCycleReset1, _ = os.ReadFile("testdata/stats/lifecycle/reset/extended1.txt")
34 dataLifeCycleReset2, _ = os.ReadFile("testdata/stats/lifecycle/reset/extended2.txt")
35 dataLifeCycleReset3, _ = os.ReadFile("testdata/stats/lifecycle/reset/extended3.txt")
36 )
37
38 func Test_testDataIsValid(t *testing.T) {
39 for name, data := range map[string][]byte{
40 "dataConfigJSON": dataConfigJSON,
41 "dataConfigYAML": dataConfigYAML,
42 "dataCommonStats": dataCommonStats,
43 "dataExtendedStats": dataExtendedStats,
44 "dataLifeCycleCumulative1": dataLifeCycleCumulative1,
45 "dataLifeCycleCumulative2": dataLifeCycleCumulative2,
46 "dataLifeCycleCumulative3": dataLifeCycleCumulative3,
47 "dataLifeCycleReset1": dataLifeCycleReset1,
48 "dataLifeCycleReset2": dataLifeCycleReset2,
49 "dataLifeCycleReset3": dataLifeCycleReset3,
50 } {
51 require.NotNil(t, data, name)
52 }
53 }
54
55 func TestCollector_ConfigurationSerialize(t *testing.T) {
56 collecttest.TestConfigurationSerialize(t, &Collector{}, dataConfigJSON, dataConfigYAML)
57 }
58
59 func TestCollector_Init(t *testing.T) {
60 collr := prepareNonTLSUnbound()
61
62 assert.NoError(t, collr.Init(context.Background()))
63 }
64
65 func TestCollector_Init_SetEverythingFromUnboundConf(t *testing.T) {
66 collr := New()
67 collr.ConfPath = "testdata/unbound.conf"
68 expectedConfig := Config{
69 Address: "10.0.0.1:8954",
70 ConfPath: collr.ConfPath,
71 Timeout: collr.Timeout,
72 Cumulative: true,
73 UseTLS: false,
74 TLSConfig: tlscfg.TLSConfig{
75 TLSCert: "/etc/unbound/unbound_control_other.pem",
76 TLSKey: "/etc/unbound/unbound_control_other.key",
77 InsecureSkipVerify: collr.TLSConfig.InsecureSkipVerify,
78 },
79 }
80
81 assert.NoError(t, collr.Init(context.Background()))
82 assert.Equal(t, expectedConfig, collr.Config)
83 }
84
85 func TestCollector_Init_DisabledInUnboundConf(t *testing.T) {
86 collr := prepareNonTLSUnbound()
87 collr.ConfPath = "testdata/unbound_disabled.conf"
88
89 assert.Error(t, collr.Init(context.Background()))
90 }
91
92 func TestCollector_Init_HandleEmptyConfig(t *testing.T) {
93 collr := prepareNonTLSUnbound()
94 collr.ConfPath = "testdata/unbound_empty.conf"
95
96 assert.NoError(t, collr.Init(context.Background()))
97 }
98
99 func TestCollector_Init_HandleNonExistentConfig(t *testing.T) {
100 collr := prepareNonTLSUnbound()
101 collr.ConfPath = "testdata/unbound_non_existent.conf"
102
103 assert.NoError(t, collr.Init(context.Background()))
104 }
105
106 func TestCollector_Check(t *testing.T) {
107 collr := prepareNonTLSUnbound()
108 require.NoError(t, collr.Init(context.Background()))
109 collr.client = mockUnboundClient{data: dataCommonStats, err: false}
110
111 assert.NoError(t, collr.Check(context.Background()))
112 }
113
114 func TestCollector_Check_ErrorDuringScrapingUnbound(t *testing.T) {
115 collr := prepareNonTLSUnbound()
116 require.NoError(t, collr.Init(context.Background()))
117 collr.client = mockUnboundClient{err: true}
118
119 assert.Error(t, collr.Check(context.Background()))
120 }
121
122 func TestCollector_Cleanup(t *testing.T) {
123 New().Cleanup(context.Background())
124 }
125
126 func TestCollector_Charts(t *testing.T) {
127 collr := prepareNonTLSUnbound()
128 require.NoError(t, collr.Init(context.Background()))
129
130 assert.NotNil(t, collr.Charts())
131 }
132
133 func TestCollector_Collect(t *testing.T) {
134 collr := prepareNonTLSUnbound()
135 require.NoError(t, collr.Init(context.Background()))
136 collr.client = mockUnboundClient{data: dataCommonStats, err: false}
137
138 mx := collr.Collect(context.Background())
139 assert.Equal(t, expectedCommon, mx)
140 testCharts(t, collr, mx)
141 }
142
143 func TestCollector_Collect_ExtendedStats(t *testing.T) {
144 collr := prepareNonTLSUnbound()
145 require.NoError(t, collr.Init(context.Background()))
146 collr.client = mockUnboundClient{data: dataExtendedStats, err: false}
147
148 mx := collr.Collect(context.Background())
149 assert.Equal(t, expectedExtended, mx)
150 testCharts(t, collr, mx)
151 }
152
153 func TestCollector_Collect_LifeCycleCumulativeExtendedStats(t *testing.T) {
154 tests := []struct {
155 input []byte
156 expected map[string]int64
157 }{
158 {input: dataLifeCycleCumulative1, expected: expectedCumulative1},
159 {input: dataLifeCycleCumulative2, expected: expectedCumulative2},
160 {input: dataLifeCycleCumulative3, expected: expectedCumulative3},
161 }
162
163 collr := prepareNonTLSUnbound()
164 collr.Cumulative = true
165 require.NoError(t, collr.Init(context.Background()))
166 ubClient := &mockUnboundClient{err: false}
167 collr.client = ubClient
168
169 var mx map[string]int64
170 for i, test := range tests {
171 t.Run(fmt.Sprintf("run %d", i+1), func(t *testing.T) {
172 ubClient.data = test.input
173 mx = collr.Collect(context.Background())
174 assert.Equal(t, test.expected, mx)
175 })
176 }
177
178 testCharts(t, collr, mx)
179 }
180
181 func TestCollector_Collect_LifeCycleResetExtendedStats(t *testing.T) {
182 tests := []struct {
183 input []byte
184 expected map[string]int64
185 }{
186 {input: dataLifeCycleReset1, expected: expectedReset1},
187 {input: dataLifeCycleReset2, expected: expectedReset2},
188 {input: dataLifeCycleReset3, expected: expectedReset3},
189 }
190
191 collr := prepareNonTLSUnbound()
192 collr.Cumulative = false
193 require.NoError(t, collr.Init(context.Background()))
194 ubClient := &mockUnboundClient{err: false}
195 collr.client = ubClient
196
197 var mx map[string]int64
198 for i, test := range tests {
199 t.Run(fmt.Sprintf("run %d", i+1), func(t *testing.T) {
200 ubClient.data = test.input
201 mx = collr.Collect(context.Background())
202 assert.Equal(t, test.expected, mx)
203 })
204 }
205
206 testCharts(t, collr, mx)
207 }
208
209 func TestCollector_Collect_EmptyResponse(t *testing.T) {
210 collr := prepareNonTLSUnbound()
211 require.NoError(t, collr.Init(context.Background()))
212 collr.client = mockUnboundClient{data: []byte{}, err: false}
213
214 assert.Nil(t, collr.Collect(context.Background()))
215 }
216
217 func TestCollector_Collect_ErrorResponse(t *testing.T) {
218 collr := prepareNonTLSUnbound()
219 require.NoError(t, collr.Init(context.Background()))
220 collr.client = mockUnboundClient{data: []byte("error unknown command 'unknown'"), err: false}
221
222 assert.Nil(t, collr.Collect(context.Background()))
223 }
224
225 func TestCollector_Collect_ErrorOnSend(t *testing.T) {
226 collr := prepareNonTLSUnbound()
227 require.NoError(t, collr.Init(context.Background()))
228 collr.client = mockUnboundClient{err: true}
229
230 assert.Nil(t, collr.Collect(context.Background()))
231 }
232
233 func TestCollector_Collect_ErrorOnParseBadSyntax(t *testing.T) {
234 collr := prepareNonTLSUnbound()
235 require.NoError(t, collr.Init(context.Background()))
236 data := strings.Repeat("zk_avg_latency 0\nzk_min_latency 0\nzk_mix_latency 0\n", 10)
237 collr.client = mockUnboundClient{data: []byte(data), err: false}
238
239 assert.Nil(t, collr.Collect(context.Background()))
240 }
241
242 func prepareNonTLSUnbound() *Collector {
243 collr := New()
244 collr.ConfPath = ""
245 collr.UseTLS = false
246
247 return collr
248 }
249
250 type mockUnboundClient struct {
251 data []byte
252 err bool
253 }
254
255 func (m mockUnboundClient) Connect() error {
256 return nil
257 }
258
259 func (m mockUnboundClient) Disconnect() error {
260 return nil
261 }
262
263 func (m mockUnboundClient) Command(_ string, process socket.Processor) error {
264 if m.err {
265 return errors.New("mock send error")
266 }
267 s := bufio.NewScanner(bytes.NewReader(m.data))
268 for s.Scan() {
269 process(s.Bytes())
270 }
271 return nil
272 }
273
274 func testCharts(t *testing.T, collr *Collector, mx map[string]int64) {
275 t.Helper()
276 ensureChartsCreatedForEveryThread(t, collr)
277 ensureExtendedChartsCreated(t, collr)
278 collecttest.TestMetricsHasAllChartsDimsSkip(t, collr.Charts(), mx, func(_ *collectorapi.Chart, dim *collectorapi.Dim) bool {
279 return dim.ID == "mem.mod.ipsecmod"
280 })
281 }
282
283 func ensureChartsCreatedForEveryThread(t *testing.T, u *Collector) {
284 for thread := range u.cache.threads {
285 for _, chart := range *threadCharts(thread, u.Cumulative) {
286 assert.Truef(t, u.Charts().Has(chart.ID), "chart '%s' is not created for '%s' thread", chart.ID, thread)
287 }
288 }
289 }
290
291 func ensureExtendedChartsCreated(t *testing.T, u *Collector) {
292 if len(u.cache.answerRCode) == 0 {
293 return
294 }
295 for _, chart := range *extendedCharts(u.Cumulative) {
296 assert.Truef(t, u.Charts().Has(chart.ID), "chart '%s' is not added", chart.ID)
297 }
298
299 if chart := u.Charts().Get(queryTypeChart.ID); chart != nil {
300 for typ := range u.cache.queryType {
301 dimID := "num.query.type." + typ
302 assert.Truef(t, chart.HasDim(dimID), "chart '%s' has no dim for '%s' type, expected '%s'", chart.ID, typ, dimID)
303 }
304 }
305 if chart := u.Charts().Get(queryClassChart.ID); chart != nil {
306 for class := range u.cache.queryClass {
307 dimID := "num.query.class." + class
308 assert.Truef(t, chart.HasDim(dimID), "chart '%s' has no dim for '%s' class, expected '%s'", chart.ID, class, dimID)
309 }
310 }
311 if chart := u.Charts().Get(queryOpCodeChart.ID); chart != nil {
312 for opcode := range u.cache.queryOpCode {
313 dimID := "num.query.opcode." + opcode
314 assert.Truef(t, chart.HasDim(dimID), "chart '%s' has no dim for '%s' opcode, expected '%s'", chart.ID, opcode, dimID)
315 }
316 }
317 if chart := u.Charts().Get(answerRCodeChart.ID); chart != nil {
318 for rcode := range u.cache.answerRCode {
319 dimID := "num.answer.rcode." + rcode
320 assert.Truef(t, chart.HasDim(dimID), "chart '%s' has no dim for '%s' rcode, expected '%s'", chart.ID, rcode, dimID)
321 }
322 }
323 }
324
325 var (
326 expectedCommon = map[string]int64{
327 "thread0.num.cachehits": 21,
328 "thread0.num.cachemiss": 7,
329 "thread0.num.dnscrypt.cert": 0,
330 "thread0.num.dnscrypt.cleartext": 0,
331 "thread0.num.dnscrypt.crypted": 0,
332 "thread0.num.dnscrypt.malformed": 0,
333 "thread0.num.expired": 0,
334 "thread0.num.prefetch": 0,
335 "thread0.num.queries": 28,
336 "thread0.num.queries_ip_ratelimited": 0,
337 "thread0.num.recursivereplies": 7,
338 "thread0.num.zero_ttl": 0,
339 "thread0.recursion.time.avg": 1255,
340 "thread0.recursion.time.median": 480,
341 "thread0.requestlist.avg": 857,
342 "thread0.requestlist.current.all": 0,
343 "thread0.requestlist.current.user": 0,
344 "thread0.requestlist.exceeded": 0,
345 "thread0.requestlist.max": 6,
346 "thread0.requestlist.overwritten": 0,
347 "thread0.tcpusage": 0,
348 "thread1.num.cachehits": 13,
349 "thread1.num.cachemiss": 3,
350 "thread1.num.dnscrypt.cert": 0,
351 "thread1.num.dnscrypt.cleartext": 0,
352 "thread1.num.dnscrypt.crypted": 0,
353 "thread1.num.dnscrypt.malformed": 0,
354 "thread1.num.prefetch": 0,
355 "thread1.num.expired": 0,
356 "thread1.num.queries": 16,
357 "thread1.num.queries_ip_ratelimited": 0,
358 "thread1.num.recursivereplies": 3,
359 "thread1.num.zero_ttl": 0,
360 "thread1.recursion.time.avg": 93,
361 "thread1.recursion.time.median": 0,
362 "thread1.requestlist.avg": 0,
363 "thread1.requestlist.current.all": 0,
364 "thread1.requestlist.current.user": 0,
365 "thread1.requestlist.exceeded": 0,
366 "thread1.requestlist.max": 0,
367 "thread1.requestlist.overwritten": 0,
368 "thread1.tcpusage": 0,
369 "time.elapsed": 88,
370 "time.now": 1574094836,
371 "time.up": 88,
372 "total.num.cachehits": 34,
373 "total.num.cachemiss": 10,
374 "total.num.dnscrypt.cert": 0,
375 "total.num.dnscrypt.cleartext": 0,
376 "total.num.dnscrypt.crypted": 0,
377 "total.num.dnscrypt.malformed": 0,
378 "total.num.prefetch": 0,
379 "total.num.expired": 0,
380 "total.num.queries": 44,
381 "total.num.queries_ip_ratelimited": 0,
382 "total.num.recursivereplies": 10,
383 "total.num.zero_ttl": 0,
384 "total.recursion.time.avg": 907,
385 "total.recursion.time.median": 240,
386 "total.requestlist.avg": 600,
387 "total.requestlist.current.all": 0,
388 "total.requestlist.current.user": 0,
389 "total.requestlist.exceeded": 0,
390 "total.requestlist.max": 6,
391 "total.requestlist.overwritten": 0,
392 "total.tcpusage": 0,
393 }
394
395 expectedExtended = map[string]int64{
396 "dnscrypt_nonce.cache.count": 0,
397 "dnscrypt_shared_secret.cache.count": 0,
398 "infra.cache.count": 205,
399 "key.cache.count": 9,
400 "mem.cache.dnscrypt_nonce": 0,
401 "mem.cache.dnscrypt_shared_secret": 0,
402 "mem.cache.message": 90357,
403 "mem.cache.rrset": 178642,
404 "mem.mod.iterator": 16588,
405 "mem.mod.respip": 0,
406 "mem.mod.subnet": 74504,
407 "mem.mod.validator": 81059,
408 "mem.streamwait": 0,
409 "msg.cache.count": 81,
410 "num.answer.bogus": 0,
411 "num.answer.rcode.FORMERR": 0,
412 "num.answer.rcode.NOERROR": 40,
413 "num.answer.rcode.NOTIMPL": 0,
414 "num.answer.rcode.NXDOMAIN": 4,
415 "num.answer.rcode.REFUSED": 0,
416 "num.answer.rcode.SERVFAIL": 0,
417 "num.answer.secure": 0,
418 "num.query.aggressive.NOERROR": 2,
419 "num.query.aggressive.NXDOMAIN": 0,
420 "num.query.authzone.down": 0,
421 "num.query.authzone.up": 0,
422 "num.query.class.IN": 44,
423 "num.query.dnscrypt.replay": 0,
424 "num.query.dnscrypt.shared_secret.cachemiss": 0,
425 "num.query.edns.DO": 0,
426 "num.query.edns.present": 0,
427 "num.query.flags.AA": 0,
428 "num.query.flags.AD": 0,
429 "num.query.flags.CD": 0,
430 "num.query.flags.QR": 0,
431 "num.query.flags.RA": 0,
432 "num.query.flags.RD": 44,
433 "num.query.flags.TC": 0,
434 "num.query.flags.Z": 0,
435 "num.query.ipv6": 39,
436 "num.query.opcode.QUERY": 44,
437 "num.query.ratelimited": 0,
438 "num.query.subnet": 0,
439 "num.query.subnet_cache": 0,
440 "num.query.tcp": 0,
441 "num.query.tcpout": 1,
442 "num.query.tls": 0,
443 "num.query.tls.resume": 0,
444 "num.query.type.A": 13,
445 "num.query.type.AAAA": 13,
446 "num.query.type.MX": 13,
447 "num.query.type.PTR": 5,
448 "num.rrset.bogus": 0,
449 "rrset.cache.count": 314,
450 "thread0.num.cachehits": 21,
451 "thread0.num.cachemiss": 7,
452 "thread0.num.dnscrypt.cert": 0,
453 "thread0.num.dnscrypt.cleartext": 0,
454 "thread0.num.dnscrypt.crypted": 0,
455 "thread0.num.dnscrypt.malformed": 0,
456 "thread0.num.expired": 0,
457 "thread0.num.prefetch": 0,
458 "thread0.num.queries": 28,
459 "thread0.num.queries_ip_ratelimited": 0,
460 "thread0.num.recursivereplies": 7,
461 "thread0.num.zero_ttl": 0,
462 "thread0.recursion.time.avg": 1255,
463 "thread0.recursion.time.median": 480,
464 "thread0.requestlist.avg": 857,
465 "thread0.requestlist.current.all": 0,
466 "thread0.requestlist.current.user": 0,
467 "thread0.requestlist.exceeded": 0,
468 "thread0.requestlist.max": 6,
469 "thread0.requestlist.overwritten": 0,
470 "thread0.tcpusage": 0,
471 "thread1.num.cachehits": 13,
472 "thread1.num.cachemiss": 3,
473 "thread1.num.dnscrypt.cert": 0,
474 "thread1.num.dnscrypt.cleartext": 0,
475 "thread1.num.dnscrypt.crypted": 0,
476 "thread1.num.dnscrypt.malformed": 0,
477 "thread1.num.prefetch": 0,
478 "thread1.num.expired": 0,
479 "thread1.num.queries": 16,
480 "thread1.num.queries_ip_ratelimited": 0,
481 "thread1.num.recursivereplies": 3,
482 "thread1.num.zero_ttl": 0,
483 "thread1.recursion.time.avg": 93,
484 "thread1.recursion.time.median": 0,
485 "thread1.requestlist.avg": 0,
486 "thread1.requestlist.current.all": 0,
487 "thread1.requestlist.current.user": 0,
488 "thread1.requestlist.exceeded": 0,
489 "thread1.requestlist.max": 0,
490 "thread1.requestlist.overwritten": 0,
491 "thread1.tcpusage": 0,
492 "time.elapsed": 88,
493 "time.now": 1574094836,
494 "time.up": 88,
495 "total.num.cachehits": 34,
496 "total.num.cachemiss": 10,
497 "total.num.dnscrypt.cert": 0,
498 "total.num.dnscrypt.cleartext": 0,
499 "total.num.dnscrypt.crypted": 0,
500 "total.num.dnscrypt.malformed": 0,
501 "total.num.prefetch": 0,
502 "total.num.expired": 0,
503 "total.num.queries": 44,
504 "total.num.queries_ip_ratelimited": 0,
505 "total.num.recursivereplies": 10,
506 "total.num.zero_ttl": 0,
507 "total.recursion.time.avg": 907,
508 "total.recursion.time.median": 240,
509 "total.requestlist.avg": 600,
510 "total.requestlist.current.all": 0,
511 "total.requestlist.current.user": 0,
512 "total.requestlist.exceeded": 0,
513 "total.requestlist.max": 6,
514 "total.requestlist.overwritten": 0,
515 "total.tcpusage": 0,
516 "unwanted.queries": 0,
517 "unwanted.replies": 0,
518 }
519 )
520
521 var (
522 expectedCumulative1 = map[string]int64{
523 "dnscrypt_nonce.cache.count": 0,
524 "dnscrypt_shared_secret.cache.count": 0,
525 "infra.cache.count": 192,
526 "key.cache.count": 11,
527 "mem.cache.dnscrypt_nonce": 0,
528 "mem.cache.dnscrypt_shared_secret": 0,
529 "mem.cache.message": 93392,
530 "mem.cache.rrset": 175745,
531 "mem.mod.iterator": 16588,
532 "mem.mod.respip": 0,
533 "mem.mod.subnet": 74504,
534 "mem.mod.validator": 81479,
535 "mem.streamwait": 0,
536 "msg.cache.count": 94,
537 "num.answer.bogus": 0,
538 "num.answer.rcode.FORMERR": 0,
539 "num.answer.rcode.NOERROR": 184,
540 "num.answer.rcode.NOTIMPL": 0,
541 "num.answer.rcode.NXDOMAIN": 16,
542 "num.answer.rcode.REFUSED": 0,
543 "num.answer.rcode.SERVFAIL": 0,
544 "num.answer.secure": 0,
545 "num.query.aggressive.NOERROR": 1,
546 "num.query.aggressive.NXDOMAIN": 0,
547 "num.query.authzone.down": 0,
548 "num.query.authzone.up": 0,
549 "num.query.class.IN": 200,
550 "num.query.dnscrypt.replay": 0,
551 "num.query.dnscrypt.shared_secret.cachemiss": 0,
552 "num.query.edns.DO": 0,
553 "num.query.edns.present": 0,
554 "num.query.flags.AA": 0,
555 "num.query.flags.AD": 0,
556 "num.query.flags.CD": 0,
557 "num.query.flags.QR": 0,
558 "num.query.flags.RA": 0,
559 "num.query.flags.RD": 200,
560 "num.query.flags.TC": 0,
561 "num.query.flags.Z": 0,
562 "num.query.ipv6": 0,
563 "num.query.opcode.QUERY": 200,
564 "num.query.ratelimited": 0,
565 "num.query.subnet": 0,
566 "num.query.subnet_cache": 0,
567 "num.query.tcp": 0,
568 "num.query.tcpout": 0,
569 "num.query.tls": 0,
570 "num.query.tls.resume": 0,
571 "num.query.type.A": 60,
572 "num.query.type.AAAA": 60,
573 "num.query.type.MX": 60,
574 "num.query.type.PTR": 20,
575 "num.rrset.bogus": 0,
576 "rrset.cache.count": 304,
577 "thread0.num.cachehits": 80,
578 "thread0.num.cachemiss": 10,
579 "thread0.num.dnscrypt.cert": 0,
580 "thread0.num.dnscrypt.cleartext": 0,
581 "thread0.num.dnscrypt.crypted": 0,
582 "thread0.num.dnscrypt.malformed": 0,
583 "thread0.num.expired": 0,
584 "thread0.num.prefetch": 0,
585 "thread0.num.queries": 90,
586 "thread0.num.queries_ip_ratelimited": 0,
587 "thread0.num.recursivereplies": 10,
588 "thread0.num.zero_ttl": 0,
589 "thread0.recursion.time.avg": 222,
590 "thread0.recursion.time.median": 337,
591 "thread0.requestlist.avg": 100,
592 "thread0.requestlist.current.all": 0,
593 "thread0.requestlist.current.user": 0,
594 "thread0.requestlist.exceeded": 0,
595 "thread0.requestlist.max": 1,
596 "thread0.requestlist.overwritten": 0,
597 "thread0.tcpusage": 0,
598 "thread1.num.cachehits": 101,
599 "thread1.num.cachemiss": 9,
600 "thread1.num.dnscrypt.cert": 0,
601 "thread1.num.dnscrypt.cleartext": 0,
602 "thread1.num.dnscrypt.crypted": 0,
603 "thread1.num.dnscrypt.malformed": 0,
604 "thread1.num.expired": 0,
605 "thread1.num.prefetch": 0,
606 "thread1.num.queries": 110,
607 "thread1.num.queries_ip_ratelimited": 0,
608 "thread1.num.recursivereplies": 9,
609 "thread1.num.zero_ttl": 0,
610 "thread1.recursion.time.avg": 844,
611 "thread1.recursion.time.median": 360,
612 "thread1.requestlist.avg": 222,
613 "thread1.requestlist.current.all": 0,
614 "thread1.requestlist.current.user": 0,
615 "thread1.requestlist.exceeded": 0,
616 "thread1.requestlist.max": 1,
617 "thread1.requestlist.overwritten": 0,
618 "thread1.tcpusage": 0,
619 "time.elapsed": 122,
620 "time.now": 1574103378,
621 "time.up": 122,
622 "total.num.cachehits": 181,
623 "total.num.cachemiss": 19,
624 "total.num.dnscrypt.cert": 0,
625 "total.num.dnscrypt.cleartext": 0,
626 "total.num.dnscrypt.crypted": 0,
627 "total.num.dnscrypt.malformed": 0,
628 "total.num.expired": 0,
629 "total.num.prefetch": 0,
630 "total.num.queries": 200,
631 "total.num.queries_ip_ratelimited": 0,
632 "total.num.recursivereplies": 19,
633 "total.num.zero_ttl": 0,
634 "total.recursion.time.avg": 516,
635 "total.recursion.time.median": 348,
636 "total.requestlist.avg": 157,
637 "total.requestlist.current.all": 0,
638 "total.requestlist.current.user": 0,
639 "total.requestlist.exceeded": 0,
640 "total.requestlist.max": 1,
641 "total.requestlist.overwritten": 0,
642 "total.tcpusage": 0,
643 "unwanted.queries": 0,
644 "unwanted.replies": 0,
645 }
646
647 expectedCumulative2 = map[string]int64{
648 "dnscrypt_nonce.cache.count": 0,
649 "dnscrypt_shared_secret.cache.count": 0,
650 "infra.cache.count": 192,
651 "key.cache.count": 11,
652 "mem.cache.dnscrypt_nonce": 0,
653 "mem.cache.dnscrypt_shared_secret": 0,
654 "mem.cache.message": 93392,
655 "mem.cache.rrset": 175745,
656 "mem.mod.iterator": 16588,
657 "mem.mod.respip": 0,
658 "mem.mod.subnet": 74504,
659 "mem.mod.validator": 81479,
660 "mem.streamwait": 0,
661 "msg.cache.count": 94,
662 "num.answer.bogus": 0,
663 "num.answer.rcode.FORMERR": 0,
664 "num.answer.rcode.NOERROR": 274,
665 "num.answer.rcode.NOTIMPL": 0,
666 "num.answer.rcode.NXDOMAIN": 16,
667 "num.answer.rcode.REFUSED": 0,
668 "num.answer.rcode.SERVFAIL": 0,
669 "num.answer.secure": 0,
670 "num.query.aggressive.NOERROR": 1,
671 "num.query.aggressive.NXDOMAIN": 0,
672 "num.query.authzone.down": 0,
673 "num.query.authzone.up": 0,
674 "num.query.class.IN": 290,
675 "num.query.dnscrypt.replay": 0,
676 "num.query.dnscrypt.shared_secret.cachemiss": 0,
677 "num.query.edns.DO": 0,
678 "num.query.edns.present": 0,
679 "num.query.flags.AA": 0,
680 "num.query.flags.AD": 0,
681 "num.query.flags.CD": 0,
682 "num.query.flags.QR": 0,
683 "num.query.flags.RA": 0,
684 "num.query.flags.RD": 290,
685 "num.query.flags.TC": 0,
686 "num.query.flags.Z": 0,
687 "num.query.ipv6": 0,
688 "num.query.opcode.QUERY": 290,
689 "num.query.ratelimited": 0,
690 "num.query.subnet": 0,
691 "num.query.subnet_cache": 0,
692 "num.query.tcp": 0,
693 "num.query.tcpout": 0,
694 "num.query.tls": 0,
695 "num.query.tls.resume": 0,
696 "num.query.type.A": 90,
697 "num.query.type.AAAA": 90,
698 "num.query.type.MX": 90,
699 "num.query.type.PTR": 20,
700 "num.rrset.bogus": 0,
701 "rrset.cache.count": 304,
702 "thread0.num.cachehits": 123,
703 "thread0.num.cachemiss": 10,
704 "thread0.num.dnscrypt.cert": 0,
705 "thread0.num.dnscrypt.cleartext": 0,
706 "thread0.num.dnscrypt.crypted": 0,
707 "thread0.num.dnscrypt.malformed": 0,
708 "thread0.num.expired": 0,
709 "thread0.num.prefetch": 0,
710 "thread0.num.queries": 133,
711 "thread0.num.queries_ip_ratelimited": 0,
712 "thread0.num.recursivereplies": 10,
713 "thread0.num.zero_ttl": 0,
714 "thread0.recursion.time.avg": 0,
715 "thread0.recursion.time.median": 0,
716 "thread0.requestlist.avg": 0,
717 "thread0.requestlist.current.all": 0,
718 "thread0.requestlist.current.user": 0,
719 "thread0.requestlist.exceeded": 0,
720 "thread0.requestlist.max": 1,
721 "thread0.requestlist.overwritten": 0,
722 "thread0.tcpusage": 0,
723 "thread1.num.cachehits": 148,
724 "thread1.num.cachemiss": 9,
725 "thread1.num.dnscrypt.cert": 0,
726 "thread1.num.dnscrypt.cleartext": 0,
727 "thread1.num.dnscrypt.crypted": 0,
728 "thread1.num.dnscrypt.malformed": 0,
729 "thread1.num.prefetch": 0,
730 "thread1.num.expired": 0,
731 "thread1.num.queries": 157,
732 "thread1.num.queries_ip_ratelimited": 0,
733 "thread1.num.recursivereplies": 9,
734 "thread1.num.zero_ttl": 0,
735 "thread1.recursion.time.avg": 0,
736 "thread1.recursion.time.median": 0,
737 "thread1.requestlist.avg": 0,
738 "thread1.requestlist.current.all": 0,
739 "thread1.requestlist.current.user": 0,
740 "thread1.requestlist.exceeded": 0,
741 "thread1.requestlist.max": 1,
742 "thread1.requestlist.overwritten": 0,
743 "thread1.tcpusage": 0,
744 "time.elapsed": 82,
745 "time.now": 1574103461,
746 "time.up": 205,
747 "total.num.cachehits": 271,
748 "total.num.cachemiss": 19,
749 "total.num.dnscrypt.cert": 0,
750 "total.num.dnscrypt.cleartext": 0,
751 "total.num.dnscrypt.crypted": 0,
752 "total.num.dnscrypt.malformed": 0,
753 "total.num.prefetch": 0,
754 "total.num.expired": 0,
755 "total.num.queries": 290,
756 "total.num.queries_ip_ratelimited": 0,
757 "total.num.recursivereplies": 19,
758 "total.num.zero_ttl": 0,
759 "total.recursion.time.avg": 0,
760 "total.recursion.time.median": 0,
761 "total.requestlist.avg": 0,
762 "total.requestlist.current.all": 0,
763 "total.requestlist.current.user": 0,
764 "total.requestlist.exceeded": 0,
765 "total.requestlist.max": 1,
766 "total.requestlist.overwritten": 0,
767 "total.tcpusage": 0,
768 "unwanted.queries": 0,
769 "unwanted.replies": 0,
770 }
771
772 expectedCumulative3 = map[string]int64{
773 "dnscrypt_nonce.cache.count": 0,
774 "dnscrypt_shared_secret.cache.count": 0,
775 "infra.cache.count": 232,
776 "key.cache.count": 14,
777 "mem.cache.dnscrypt_nonce": 0,
778 "mem.cache.dnscrypt_shared_secret": 0,
779 "mem.cache.message": 101198,
780 "mem.cache.rrset": 208839,
781 "mem.mod.iterator": 16588,
782 "mem.mod.respip": 0,
783 "mem.mod.subnet": 74504,
784 "mem.mod.validator": 85725,
785 "mem.streamwait": 0,
786 "msg.cache.count": 119,
787 "num.answer.bogus": 0,
788 "num.answer.rcode.FORMERR": 0,
789 "num.answer.rcode.NOERROR": 334,
790 "num.answer.rcode.NOTIMPL": 0,
791 "num.answer.rcode.NXDOMAIN": 16,
792 "num.answer.rcode.REFUSED": 0,
793 "num.answer.rcode.SERVFAIL": 10,
794 "num.answer.rcode.nodata": 20,
795 "num.answer.secure": 0,
796 "num.query.aggressive.NOERROR": 1,
797 "num.query.aggressive.NXDOMAIN": 0,
798 "num.query.authzone.down": 0,
799 "num.query.authzone.up": 0,
800 "num.query.class.IN": 360,
801 "num.query.dnscrypt.replay": 0,
802 "num.query.dnscrypt.shared_secret.cachemiss": 0,
803 "num.query.edns.DO": 0,
804 "num.query.edns.present": 0,
805 "num.query.flags.AA": 0,
806 "num.query.flags.AD": 0,
807 "num.query.flags.CD": 0,
808 "num.query.flags.QR": 0,
809 "num.query.flags.RA": 0,
810 "num.query.flags.RD": 360,
811 "num.query.flags.TC": 0,
812 "num.query.flags.Z": 0,
813 "num.query.ipv6": 0,
814 "num.query.opcode.QUERY": 360,
815 "num.query.ratelimited": 0,
816 "num.query.subnet": 0,
817 "num.query.subnet_cache": 0,
818 "num.query.tcp": 0,
819 "num.query.tcpout": 0,
820 "num.query.tls": 0,
821 "num.query.tls.resume": 0,
822 "num.query.type.A": 120,
823 "num.query.type.AAAA": 110,
824 "num.query.type.MX": 110,
825 "num.query.type.PTR": 20,
826 "num.rrset.bogus": 0,
827 "rrset.cache.count": 401,
828 "thread0.num.cachehits": 150,
829 "thread0.num.cachemiss": 15,
830 "thread0.num.dnscrypt.cert": 0,
831 "thread0.num.dnscrypt.cleartext": 0,
832 "thread0.num.dnscrypt.crypted": 0,
833 "thread0.num.dnscrypt.malformed": 0,
834 "thread0.num.expired": 0,
835 "thread0.num.prefetch": 0,
836 "thread0.num.queries": 165,
837 "thread0.num.queries_ip_ratelimited": 0,
838 "thread0.num.recursivereplies": 15,
839 "thread0.num.zero_ttl": 0,
840 "thread0.recursion.time.avg": 261,
841 "thread0.recursion.time.median": 318,
842 "thread0.requestlist.avg": 66,
843 "thread0.requestlist.current.all": 0,
844 "thread0.requestlist.current.user": 0,
845 "thread0.requestlist.exceeded": 0,
846 "thread0.requestlist.max": 1,
847 "thread0.requestlist.overwritten": 0,
848 "thread0.tcpusage": 0,
849 "thread1.num.cachehits": 184,
850 "thread1.num.cachemiss": 11,
851 "thread1.num.dnscrypt.cert": 0,
852 "thread1.num.dnscrypt.cleartext": 0,
853 "thread1.num.dnscrypt.crypted": 0,
854 "thread1.num.dnscrypt.malformed": 0,
855 "thread1.num.prefetch": 0,
856 "thread1.num.expired": 0,
857 "thread1.num.queries": 195,
858 "thread1.num.queries_ip_ratelimited": 0,
859 "thread1.num.recursivereplies": 11,
860 "thread1.num.zero_ttl": 0,
861 "thread1.recursion.time.avg": 709,
862 "thread1.recursion.time.median": 294,
863 "thread1.requestlist.avg": 363,
864 "thread1.requestlist.current.all": 0,
865 "thread1.requestlist.current.user": 0,
866 "thread1.requestlist.exceeded": 0,
867 "thread1.requestlist.max": 2,
868 "thread1.requestlist.overwritten": 0,
869 "thread1.tcpusage": 0,
870 "time.elapsed": 82,
871 "time.now": 1574103543,
872 "time.up": 288,
873 "total.num.cachehits": 334,
874 "total.num.cachemiss": 26,
875 "total.num.dnscrypt.cert": 0,
876 "total.num.dnscrypt.cleartext": 0,
877 "total.num.dnscrypt.crypted": 0,
878 "total.num.dnscrypt.malformed": 0,
879 "total.num.prefetch": 0,
880 "total.num.expired": 0,
881 "total.num.queries": 360,
882 "total.num.queries_ip_ratelimited": 0,
883 "total.num.recursivereplies": 26,
884 "total.num.zero_ttl": 0,
885 "total.recursion.time.avg": 450,
886 "total.recursion.time.median": 306,
887 "total.requestlist.avg": 192,
888 "total.requestlist.current.all": 0,
889 "total.requestlist.current.user": 0,
890 "total.requestlist.exceeded": 0,
891 "total.requestlist.max": 2,
892 "total.requestlist.overwritten": 0,
893 "total.tcpusage": 0,
894 "unwanted.queries": 0,
895 "unwanted.replies": 0,
896 }
897 )
898
899 var (
900 expectedReset1 = map[string]int64{
901 "dnscrypt_nonce.cache.count": 0,
902 "dnscrypt_shared_secret.cache.count": 0,
903 "infra.cache.count": 181,
904 "key.cache.count": 10,
905 "mem.cache.dnscrypt_nonce": 0,
906 "mem.cache.dnscrypt_shared_secret": 0,
907 "mem.cache.message": 86064,
908 "mem.cache.rrset": 172757,
909 "mem.mod.iterator": 16588,
910 "mem.mod.respip": 0,
911 "mem.mod.subnet": 74504,
912 "mem.mod.validator": 79979,
913 "mem.streamwait": 0,
914 "msg.cache.count": 67,
915 "num.answer.bogus": 0,
916 "num.answer.rcode.FORMERR": 0,
917 "num.answer.rcode.NOERROR": 90,
918 "num.answer.rcode.NOTIMPL": 0,
919 "num.answer.rcode.NXDOMAIN": 10,
920 "num.answer.rcode.REFUSED": 0,
921 "num.answer.rcode.SERVFAIL": 0,
922 "num.answer.rcode.nodata": 10,
923 "num.answer.secure": 0,
924 "num.query.aggressive.NOERROR": 2,
925 "num.query.aggressive.NXDOMAIN": 0,
926 "num.query.authzone.down": 0,
927 "num.query.authzone.up": 0,
928 "num.query.class.IN": 100,
929 "num.query.dnscrypt.replay": 0,
930 "num.query.dnscrypt.shared_secret.cachemiss": 0,
931 "num.query.edns.DO": 0,
932 "num.query.edns.present": 0,
933 "num.query.flags.AA": 0,
934 "num.query.flags.AD": 0,
935 "num.query.flags.CD": 0,
936 "num.query.flags.QR": 0,
937 "num.query.flags.RA": 0,
938 "num.query.flags.RD": 100,
939 "num.query.flags.TC": 0,
940 "num.query.flags.Z": 0,
941 "num.query.ipv6": 0,
942 "num.query.opcode.QUERY": 100,
943 "num.query.ratelimited": 0,
944 "num.query.subnet": 0,
945 "num.query.subnet_cache": 0,
946 "num.query.tcp": 0,
947 "num.query.tcpout": 1,
948 "num.query.tls": 0,
949 "num.query.tls.resume": 0,
950 "num.query.type.A": 30,
951 "num.query.type.AAAA": 30,
952 "num.query.type.MX": 30,
953 "num.query.type.PTR": 10,
954 "num.rrset.bogus": 0,
955 "rrset.cache.count": 303,
956 "thread0.num.cachehits": 44,
957 "thread0.num.cachemiss": 7,
958 "thread0.num.dnscrypt.cert": 0,
959 "thread0.num.dnscrypt.cleartext": 0,
960 "thread0.num.dnscrypt.crypted": 0,
961 "thread0.num.dnscrypt.malformed": 0,
962 "thread0.num.expired": 0,
963 "thread0.num.prefetch": 0,
964 "thread0.num.queries": 51,
965 "thread0.num.queries_ip_ratelimited": 0,
966 "thread0.num.recursivereplies": 7,
967 "thread0.num.zero_ttl": 0,
968 "thread0.recursion.time.avg": 365,
969 "thread0.recursion.time.median": 57,
970 "thread0.requestlist.avg": 0,
971 "thread0.requestlist.current.all": 0,
972 "thread0.requestlist.current.user": 0,
973 "thread0.requestlist.exceeded": 0,
974 "thread0.requestlist.max": 0,
975 "thread0.requestlist.overwritten": 0,
976 "thread0.tcpusage": 0,
977 "thread1.num.cachehits": 46,
978 "thread1.num.cachemiss": 3,
979 "thread1.num.dnscrypt.cert": 0,
980 "thread1.num.dnscrypt.cleartext": 0,
981 "thread1.num.dnscrypt.crypted": 0,
982 "thread1.num.dnscrypt.malformed": 0,
983 "thread1.num.prefetch": 0,
984 "thread1.num.expired": 0,
985 "thread1.num.queries": 49,
986 "thread1.num.queries_ip_ratelimited": 0,
987 "thread1.num.recursivereplies": 3,
988 "thread1.num.zero_ttl": 0,
989 "thread1.recursion.time.avg": 1582,
990 "thread1.recursion.time.median": 0,
991 "thread1.requestlist.avg": 0,
992 "thread1.requestlist.current.all": 0,
993 "thread1.requestlist.current.user": 0,
994 "thread1.requestlist.exceeded": 0,
995 "thread1.requestlist.max": 0,
996 "thread1.requestlist.overwritten": 0,
997 "thread1.tcpusage": 0,
998 "time.elapsed": 45,
999 "time.now": 1574103644,
1000 "time.up": 45,
1001 "total.num.cachehits": 90,
1002 "total.num.cachemiss": 10,
1003 "total.num.dnscrypt.cert": 0,
1004 "total.num.dnscrypt.cleartext": 0,
1005 "total.num.dnscrypt.crypted": 0,
1006 "total.num.dnscrypt.malformed": 0,
1007 "total.num.prefetch": 0,
1008 "total.num.expired": 0,
1009 "total.num.queries": 100,
1010 "total.num.queries_ip_ratelimited": 0,
1011 "total.num.recursivereplies": 10,
1012 "total.num.zero_ttl": 0,
1013 "total.recursion.time.avg": 730,
1014 "total.recursion.time.median": 28,
1015 "total.requestlist.avg": 0,
1016 "total.requestlist.current.all": 0,
1017 "total.requestlist.current.user": 0,
1018 "total.requestlist.exceeded": 0,
1019 "total.requestlist.max": 0,
1020 "total.requestlist.overwritten": 0,
1021 "total.tcpusage": 0,
1022 "unwanted.queries": 0,
1023 "unwanted.replies": 0,
1024 }
1025 expectedReset2 = map[string]int64{
1026 "dnscrypt_nonce.cache.count": 0,
1027 "dnscrypt_shared_secret.cache.count": 0,
1028 "infra.cache.count": 181,
1029 "key.cache.count": 10,
1030 "mem.cache.dnscrypt_nonce": 0,
1031 "mem.cache.dnscrypt_shared_secret": 0,
1032 "mem.cache.message": 86064,
1033 "mem.cache.rrset": 172757,
1034 "mem.mod.iterator": 16588,
1035 "mem.mod.respip": 0,
1036 "mem.mod.subnet": 74504,
1037 "mem.mod.validator": 79979,
1038 "mem.streamwait": 0,
1039 "msg.cache.count": 67,
1040 "num.answer.bogus": 0,
1041 "num.answer.rcode.FORMERR": 0,
1042 "num.answer.rcode.NOERROR": 0,
1043 "num.answer.rcode.NOTIMPL": 0,
1044 "num.answer.rcode.NXDOMAIN": 0,
1045 "num.answer.rcode.REFUSED": 0,
1046 "num.answer.rcode.SERVFAIL": 0,
1047 "num.answer.rcode.nodata": 0,
1048 "num.answer.secure": 0,
1049 "num.query.aggressive.NOERROR": 0,
1050 "num.query.aggressive.NXDOMAIN": 0,
1051 "num.query.authzone.down": 0,
1052 "num.query.authzone.up": 0,
1053 "num.query.class.IN": 0,
1054 "num.query.dnscrypt.replay": 0,
1055 "num.query.dnscrypt.shared_secret.cachemiss": 0,
1056 "num.query.edns.DO": 0,
1057 "num.query.edns.present": 0,
1058 "num.query.flags.AA": 0,
1059 "num.query.flags.AD": 0,
1060 "num.query.flags.CD": 0,
1061 "num.query.flags.QR": 0,
1062 "num.query.flags.RA": 0,
1063 "num.query.flags.RD": 0,
1064 "num.query.flags.TC": 0,
1065 "num.query.flags.Z": 0,
1066 "num.query.ipv6": 0,
1067 "num.query.opcode.QUERY": 0,
1068 "num.query.ratelimited": 0,
1069 "num.query.subnet": 0,
1070 "num.query.subnet_cache": 0,
1071 "num.query.tcp": 0,
1072 "num.query.tcpout": 0,
1073 "num.query.tls": 0,
1074 "num.query.tls.resume": 0,
1075 "num.query.type.A": 0,
1076 "num.query.type.AAAA": 0,
1077 "num.query.type.MX": 0,
1078 "num.query.type.PTR": 0,
1079 "num.rrset.bogus": 0,
1080 "rrset.cache.count": 303,
1081 "thread0.num.cachehits": 0,
1082 "thread0.num.cachemiss": 0,
1083 "thread0.num.dnscrypt.cert": 0,
1084 "thread0.num.dnscrypt.cleartext": 0,
1085 "thread0.num.dnscrypt.crypted": 0,
1086 "thread0.num.dnscrypt.malformed": 0,
1087 "thread0.num.expired": 0,
1088 "thread0.num.prefetch": 0,
1089 "thread0.num.queries": 0,
1090 "thread0.num.queries_ip_ratelimited": 0,
1091 "thread0.num.recursivereplies": 0,
1092 "thread0.num.zero_ttl": 0,
1093 "thread0.recursion.time.avg": 0,
1094 "thread0.recursion.time.median": 0,
1095 "thread0.requestlist.avg": 0,
1096 "thread0.requestlist.current.all": 0,
1097 "thread0.requestlist.current.user": 0,
1098 "thread0.requestlist.exceeded": 0,
1099 "thread0.requestlist.max": 0,
1100 "thread0.requestlist.overwritten": 0,
1101 "thread0.tcpusage": 0,
1102 "thread1.num.cachehits": 0,
1103 "thread1.num.cachemiss": 0,
1104 "thread1.num.dnscrypt.cert": 0,
1105 "thread1.num.dnscrypt.cleartext": 0,
1106 "thread1.num.dnscrypt.crypted": 0,
1107 "thread1.num.dnscrypt.malformed": 0,
1108 "thread1.num.prefetch": 0,
1109 "thread1.num.expired": 0,
1110 "thread1.num.queries": 0,
1111 "thread1.num.queries_ip_ratelimited": 0,
1112 "thread1.num.recursivereplies": 0,
1113 "thread1.num.zero_ttl": 0,
1114 "thread1.recursion.time.avg": 0,
1115 "thread1.recursion.time.median": 0,
1116 "thread1.requestlist.avg": 0,
1117 "thread1.requestlist.current.all": 0,
1118 "thread1.requestlist.current.user": 0,
1119 "thread1.requestlist.exceeded": 0,
1120 "thread1.requestlist.max": 0,
1121 "thread1.requestlist.overwritten": 0,
1122 "thread1.tcpusage": 0,
1123 "time.elapsed": 26,
1124 "time.now": 1574103671,
1125 "time.up": 71,
1126 "total.num.cachehits": 0,
1127 "total.num.cachemiss": 0,
1128 "total.num.dnscrypt.cert": 0,
1129 "total.num.dnscrypt.cleartext": 0,
1130 "total.num.dnscrypt.crypted": 0,
1131 "total.num.dnscrypt.malformed": 0,
1132 "total.num.prefetch": 0,
1133 "total.num.expired": 0,
1134 "total.num.queries": 0,
1135 "total.num.queries_ip_ratelimited": 0,
1136 "total.num.recursivereplies": 0,
1137 "total.num.zero_ttl": 0,
1138 "total.recursion.time.avg": 0,
1139 "total.recursion.time.median": 0,
1140 "total.requestlist.avg": 0,
1141 "total.requestlist.current.all": 0,
1142 "total.requestlist.current.user": 0,
1143 "total.requestlist.exceeded": 0,
1144 "total.requestlist.max": 0,
1145 "total.requestlist.overwritten": 0,
1146 "total.tcpusage": 0,
1147 "unwanted.queries": 0,
1148 "unwanted.replies": 0,
1149 }
1150
1151 expectedReset3 = map[string]int64{
1152 "dnscrypt_nonce.cache.count": 0,
1153 "dnscrypt_shared_secret.cache.count": 0,
1154 "infra.cache.count": 303,
1155 "key.cache.count": 15,
1156 "mem.cache.dnscrypt_nonce": 0,
1157 "mem.cache.dnscrypt_shared_secret": 0,
1158 "mem.cache.message": 105471,
1159 "mem.cache.rrset": 235917,
1160 "mem.mod.iterator": 16588,
1161 "mem.mod.respip": 0,
1162 "mem.mod.subnet": 74504,
1163 "mem.mod.validator": 87270,
1164 "mem.streamwait": 0,
1165 "msg.cache.count": 127,
1166 "num.answer.bogus": 0,
1167 "num.answer.rcode.FORMERR": 0,
1168 "num.answer.rcode.NOERROR": 60,
1169 "num.answer.rcode.NOTIMPL": 0,
1170 "num.answer.rcode.NXDOMAIN": 10,
1171 "num.answer.rcode.REFUSED": 0,
1172 "num.answer.rcode.SERVFAIL": 0,
1173 "num.answer.rcode.nodata": 10,
1174 "num.answer.secure": 0,
1175 "num.query.aggressive.NOERROR": 2,
1176 "num.query.aggressive.NXDOMAIN": 0,
1177 "num.query.authzone.down": 0,
1178 "num.query.authzone.up": 0,
1179 "num.query.class.IN": 70,
1180 "num.query.dnscrypt.replay": 0,
1181 "num.query.dnscrypt.shared_secret.cachemiss": 0,
1182 "num.query.edns.DO": 0,
1183 "num.query.edns.present": 0,
1184 "num.query.flags.AA": 0,
1185 "num.query.flags.AD": 0,
1186 "num.query.flags.CD": 0,
1187 "num.query.flags.QR": 0,
1188 "num.query.flags.RA": 0,
1189 "num.query.flags.RD": 70,
1190 "num.query.flags.TC": 0,
1191 "num.query.flags.Z": 0,
1192 "num.query.ipv6": 0,
1193 "num.query.opcode.QUERY": 70,
1194 "num.query.ratelimited": 0,
1195 "num.query.subnet": 0,
1196 "num.query.subnet_cache": 0,
1197 "num.query.tcp": 0,
1198 "num.query.tcpout": 0,
1199 "num.query.tls": 0,
1200 "num.query.tls.resume": 0,
1201 "num.query.type.A": 20,
1202 "num.query.type.AAAA": 20,
1203 "num.query.type.MX": 20,
1204 "num.query.type.PTR": 10,
1205 "num.rrset.bogus": 0,
1206 "rrset.cache.count": 501,
1207 "thread0.num.cachehits": 30,
1208 "thread0.num.cachemiss": 4,
1209 "thread0.num.dnscrypt.cert": 0,
1210 "thread0.num.dnscrypt.cleartext": 0,
1211 "thread0.num.dnscrypt.crypted": 0,
1212 "thread0.num.dnscrypt.malformed": 0,
1213 "thread0.num.expired": 0,
1214 "thread0.num.prefetch": 0,
1215 "thread0.num.queries": 34,
1216 "thread0.num.queries_ip_ratelimited": 0,
1217 "thread0.num.recursivereplies": 4,
1218 "thread0.num.zero_ttl": 0,
1219 "thread0.recursion.time.avg": 541,
1220 "thread0.recursion.time.median": 98,
1221 "thread0.requestlist.avg": 0,
1222 "thread0.requestlist.current.all": 0,
1223 "thread0.requestlist.current.user": 0,
1224 "thread0.requestlist.exceeded": 0,
1225 "thread0.requestlist.max": 0,
1226 "thread0.requestlist.overwritten": 0,
1227 "thread0.tcpusage": 0,
1228 "thread1.num.cachehits": 33,
1229 "thread1.num.cachemiss": 3,
1230 "thread1.num.dnscrypt.cert": 0,
1231 "thread1.num.dnscrypt.cleartext": 0,
1232 "thread1.num.dnscrypt.crypted": 0,
1233 "thread1.num.dnscrypt.malformed": 0,
1234 "thread1.num.prefetch": 0,
1235 "thread1.num.expired": 0,
1236 "thread1.num.queries": 36,
1237 "thread1.num.queries_ip_ratelimited": 0,
1238 "thread1.num.recursivereplies": 3,
1239 "thread1.num.zero_ttl": 0,
1240 "thread1.recursion.time.avg": 62,
1241 "thread1.recursion.time.median": 0,
1242 "thread1.requestlist.avg": 1666,
1243 "thread1.requestlist.current.all": 0,
1244 "thread1.requestlist.current.user": 0,
1245 "thread1.requestlist.exceeded": 0,
1246 "thread1.requestlist.max": 5,
1247 "thread1.requestlist.overwritten": 0,
1248 "thread1.tcpusage": 0,
1249 "time.elapsed": 59,
1250 "time.now": 1574103731,
1251 "time.up": 131,
1252 "total.num.cachehits": 63,
1253 "total.num.cachemiss": 7,
1254 "total.num.dnscrypt.cert": 0,
1255 "total.num.dnscrypt.cleartext": 0,
1256 "total.num.dnscrypt.crypted": 0,
1257 "total.num.dnscrypt.malformed": 0,
1258 "total.num.prefetch": 0,
1259 "total.num.expired": 0,
1260 "total.num.queries": 70,
1261 "total.num.queries_ip_ratelimited": 0,
1262 "total.num.recursivereplies": 7,
1263 "total.num.zero_ttl": 0,
1264 "total.recursion.time.avg": 336,
1265 "total.recursion.time.median": 49,
1266 "total.requestlist.avg": 714,
1267 "total.requestlist.current.all": 0,
1268 "total.requestlist.current.user": 0,
1269 "total.requestlist.exceeded": 0,
1270 "total.requestlist.max": 5,
1271 "total.requestlist.overwritten": 0,
1272 "total.tcpusage": 0,
1273 "unwanted.queries": 0,
1274 "unwanted.replies": 0,
1275 }
1276 )