Changeset 2af2d1e9f3a5f328366da7a13806fa087eaafda7

Show
Ignore:
Timestamp:
05/14/08 19:49:17 (11 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1210794557 +0000
git-parent:

[2ccf5eb9e64a6e89f4c8e0022eee38cde7e74717]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1210794557 +0000
Message:

add duration as a first-class metric

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/http.c

    r7a82302 r2af2d1e  
    151151  stats_t current; 
    152152  int expect_code = 200; 
     153  u_int32_t duration_ms; 
    153154  void *code_str; /* void * for use with hash */ 
    154155  char human_buffer[256], code[4], rt[14]; 
     
    173174  memcpy(&current.whence, &ci->finish_time, sizeof(current.whence)); 
    174175  current.duration = duration.tv_sec * 1000 + duration.tv_usec / 1000; 
     176  duration_ms = current.duration; 
    175177  current.available = (ci->timed_out || !ci->status.code) ? NP_UNAVAILABLE : NP_AVAILABLE; 
    176178  current.state = (ci->status.code != 200) ? NP_BAD : NP_GOOD; 
     
    181183    noit_stats_set_metric(&current, "bytes", 
    182184                          METRIC_INT32, &ci->body.l); 
     185    noit_stats_set_metric(&current, "duration", 
     186                          METRIC_UINT32, &duration_ms); 
    183187  } 
    184188  else { 
    185189    noit_stats_set_metric(&current, "code", METRIC_STRING, NULL); 
    186190    noit_stats_set_metric(&current, "bytes", METRIC_INT32, NULL); 
     191    noit_stats_set_metric(&current, "duration", METRIC_UINT32, NULL); 
    187192  } 
    188193  noit_check_set_stats(self, check, &current);