]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Add a Lua binding for the number of queries dropped by a server
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 11 Dec 2020 16:34:39 +0000 (17:34 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 11 Dec 2020 16:39:14 +0000 (17:39 +0100)
pdns/dnsdist-lua-bindings.cc
pdns/dnsdistdist/docs/reference/config.rst

index 50e95bf60a91f8996d45c4d3da7a5f6390723e8b..24a1da3710d611ee4b559bca5bab7485d9a0658e 100644 (file)
@@ -103,6 +103,7 @@ void setupLuaBindings(LuaContext& luaCtx, bool client)
       s->pools.erase(pool);
     });
   luaCtx.registerFunction<uint64_t(DownstreamState::*)()const>("getOutstanding", [](const DownstreamState& s) { return s.outstanding.load(); });
+  luaCtx.registerFunction<uint64_t(DownstreamState::*)()const>("getDrops", [](const DownstreamState& s) { return s.reuseds.load(); });
   luaCtx.registerFunction<double(DownstreamState::*)()const>("getLatency", [](const DownstreamState& s) { return s.latencyUsec; });
   luaCtx.registerFunction("isUp", &DownstreamState::isUp);
   luaCtx.registerFunction("setDown", &DownstreamState::setDown);
index 973e6c3a4f8eb7df6f548ed42e085cb920b99da7..6a210d44234edb1306c3405d41809cd2db0fbef7 100644 (file)
@@ -603,6 +603,14 @@ A server object returned by :func:`getServer` can be manipulated with these func
 
     :returns: A string containing the server name if any plus the server address and port
 
+  .. method:: Server:getDrops() -> int
+
+    .. versionadded:: 1.6.0
+
+    Get the number of dropped queries for this server.
+
+    :returns: The number of outstanding queries
+
   .. method:: Server:getOutstanding() -> int
 
     Get the number of outstanding queries for this server.