[rrd-developers] [PATCH] add stats for rrdcached fetch operations

Thorsten von Eicken tve at voneicken.com
Wed Jun 16 07:45:39 CEST 2010


The following patches add FetchesReceived stats to the rrdcached stats 
command.

---src/rrd_daemon.c2010-04-30  14:25:35.000000000  +0000
+++  src/rrd_daemon.c2010-04-30  14:27:17.000000000  +0000
@@ -266,6  +266,7  @@
  static uint64_t stats_queue_length=  0;
  static uint64_t stats_updates_received=  0;
  static uint64_t stats_flush_received=  0;
+static uint64_t stats_fetch_received=  0;
  static uint64_t stats_updates_written=  0;
  static uint64_t stats_data_sets_written=  0;
  static uint64_t stats_journal_bytes=  0;
@@ -1140,6  +1141,7  @@
    uint64_t copy_queue_length;
    uint64_t copy_updates_received;
    uint64_t copy_flush_received;
+   uint64_t copy_fetch_received;
    uint64_t copy_updates_written;
    uint64_t copy_data_sets_written;
    uint64_t copy_journal_bytes;
@@ -1152,6  +1153,7  @@
    copy_queue_length=  stats_queue_length;
    copy_updates_received=  stats_updates_received;
    copy_flush_received=  stats_flush_received;
+   copy_fetch_received=  stats_fetch_received;
    copy_updates_written=  stats_updates_written;
    copy_data_sets_written=  stats_data_sets_written;
    copy_journal_bytes=  stats_journal_bytes;
@@ -1170,6  +1172,8  @@
    add_response_info(sock,
                      "FlushesReceived: %"PRIu64"\n",  copy_flush_received);
    add_response_info(sock,
+                     "FetchesReceived: %"PRIu64"\n",  copy_fetch_received);
+   add_response_info(sock,
                      "UpdatesWritten: %"PRIu64"\n",  copy_updates_written);
    add_response_info(sock,
                      "DataSetsWritten: %"PRIu64"\n",  copy_data_sets_written);
@@ -1530,6  +1534,10  @@
    if  (status!=  0)
      return  (syntax_error(sock,cmd));

+   pthread_mutex_lock(&stats_lock);
+   stats_fetch_received++;
+   pthread_mutex_unlock(&stats_lock);
+
    get_abs_path(&file,  file_tmp);
    if  (!check_file_access(file,  sock))  return  0;
---src/rrd_client.c2010-06-15  22:31:00.445356800  -0700
+++  src/rrd_client.c2010-06-15  22:30:14.405723500  -0700
@@ -1127,6  +1127,7  @@
      }
      else  if  ((strcmp("DataSetsWritten",  key)  ==  0)
          ||  (strcmp("FlushesReceived",  key)  ==  0)
+         ||  (strcmp("FetchesReceived",  key)  ==  0)
          ||  (strcmp("JournalBytes",  key)  ==  0)
          ||  (strcmp("JournalRotate",  key)  ==  0)
          ||  (strcmp("UpdatesReceived",  key)  ==  0)




More information about the rrd-developers mailing list