PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.72k stars 912 forks source link

dnsdist: add elapsed time to dq object #14850

Closed phonedph1 closed 4 days ago

phonedph1 commented 1 week ago

Short description

FFI seems to have this already.

Not sure if there is a reason not to include it in the normal Lua bindings?

Use case: want to easily check how much time has been spent so far, to decide if query should be replayed or not.

function result(dq)
        warnlog("query elapsed time is " .. dq:getElapsedUs() .. " us")

        return DNSResponseAction.None
end

addAction(AllRule(), LuaAction(result))
addResponseAction(AllRule(),LuaResponseAction(result))

addLocal("127.0.0.1:5454")
newServer({address="8.8.8.8"})
query elapsed time is 69.56 us
query elapsed time is 34759.856 us

Checklist

I have:

coveralls commented 1 week ago

Pull Request Test Coverage Report for Build 11943315686

Details


Files with Coverage Reduction New Missed Lines %
pdns/webserver.hh 1 69.16%
pdns/recursordist/sortlist.hh 1 75.0%
pdns/iputils.hh 1 78.2%
pdns/dnsdistdist/dnsdist-crypto.cc 1 76.01%
pdns/pollmplexer.cc 1 83.66%
pdns/dnstap.cc 2 70.97%
ext/probds/murmur3.cc 2 94.12%
pdns/dnsname.hh 2 91.84%
modules/godbcbackend/sodbc.cc 2 70.8%
pdns/sstuff.hh 2 56.83%
<!-- Total: 5592 -->
Totals Coverage Status
Change from base Build 11915618754: -0.1%
Covered Lines: 125729
Relevant Lines: 163620

💛 - Coveralls
rgacogne commented 6 days ago

Marking this PR as a candidate for a backport to 1.9.x since it is very self-contained and could be useful there.

phonedph1 commented 5 days ago

moved the docs up...