Code

empty_counter match: Add support for the DERIVE data source type.
[collectd.git] / src / match_empty_counter.c
index 8f99a6d163cc0c4547fa516d30816e8d50181bc7..caa3e7e302c000c342775e64665f5aa46ac3c6b0 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "collectd.h"
 #include "common.h"
-#include "utils_cache.h"
 #include "filter_chain.h"
 
 /*
@@ -90,11 +89,13 @@ static int mec_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */
 
   for (i = 0; i < ds->ds_num; i++)
   {
-    if (ds->ds[i].type != DS_TYPE_COUNTER)
+    if ((ds->ds[i].type != DS_TYPE_DERIVE)
+        && (ds->ds[i].type != DS_TYPE_COUNTER))
       continue;
 
     num_counters++;
-    if (vl->values[i].counter == 0)
+    if (((ds->ds[i].type == DS_TYPE_DERIVE) && (vl->values[i].derive == 0))
+        || ((ds->ds[i].type == DS_TYPE_COUNTER) && (vl->values[i].counter == 0)))
       num_empty++;
   }