]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/graphite: track cache statistics as well
authorMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 27 May 2015 17:27:12 +0000 (19:27 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 27 May 2015 17:27:12 +0000 (19:27 +0200)
modules/graphite/graphite.lua

index 015ebd46e77fe9c5f3f3d707dbb6dad545401219..11150bea7e8c52ecf52d90f4551e604f00b80745 100644 (file)
@@ -22,15 +22,19 @@ function graphite.publish()
        if type(now_metrics) ~= 'table' then
                return 0 -- No metrics to watch
        end
-       for key,val in pairs(now_metrics) do
-               local msg = key..' '..val..' '..now..'\n'
-               if graphite.prefix then
-                       msg = graphite.prefix..'.'..msg
-               end
-               for i in ipairs(graphite.cli) do
-                       graphite.cli[i]:send(msg)
+       local function publish_table(metrics, prefix)
+               for key,val in pairs(metrics) do
+                       local msg = key..' '..val..' '..now..'\n'
+                       if prefix then
+                               msg = prefix..'.'..msg
+                       end
+                       for i in ipairs(graphite.cli) do
+                               graphite.cli[i]:send(msg)
+                       end
                end
        end
+       publish_table(now_metrics, graphite.prefix)
+       publish_table(cache.stats(), graphite.prefix..'.cache')
        return 0
 end