summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorPetr Špaček <petr.spacek@nic.cz>2020-04-27 08:13:57 +0200
committerTomas Krizek <tomas.krizek@nic.cz>2020-04-27 15:39:38 +0200
commitdf03cb2926f810d268207718397d06b54a9c2c09 (patch)
tree7cc50d4ced0bfb9ae58184f31e80d4fe24abb1bd /etc
parentdocker: enable DO bit in debug mode (diff)
downloadknot-resolver-df03cb2926f810d268207718397d06b54a9c2c09.tar.xz
knot-resolver-df03cb2926f810d268207718397d06b54a9c2c09.zip
docker: measure request resolution time in debug mode
Diffstat (limited to 'etc')
-rw-r--r--etc/config/config.docker7
1 files changed, 6 insertions, 1 deletions
diff --git a/etc/config/config.docker b/etc/config/config.docker
index 9f27c934..8e82a609 100644
--- a/etc/config/config.docker
+++ b/etc/config/config.docker
@@ -55,12 +55,15 @@ function debug_mode(qname, qtype)
-- always empty cache so this config works reliably outside Docker
cache.clear()
+ local cqueues = require('cqueues')
+
-- execute query right after start up and exit when the query is finished
event.after(0, function()
-- ultra verbose log
verbose(true)
policy.add(policy.all(policy.DEBUG_ALWAYS))
- log('INFO: starting your DNS query for %s %s, verbose log follows', qname, kres.tostring.type[qtype])
+ log('INFO: starting DNS query for %s %s', qname, kres.tostring.type[qtype])
+ local starttime = cqueues.monotime()
resolve({
name = qname,
type = qtype,
@@ -70,6 +73,8 @@ function debug_mode(qname, qtype)
-- to prevent us from losing policy.DEBUG finish callback
event.after(1, -- milisecond
function()
+ local endtime = cqueues.monotime()
+ log('\nrequest finished in %f ms', (endtime - starttime) * 1000)
os.exit()
end)
end