Changeset 27a5e331e0c69b61663894284bea87f17f1ed062
 Timestamp:
 05/22/12 19:36:13
(3 years ago)
 Author:
 Theo Schlossnagle <jesus@omniti.com>
 gitcommitter:
 Theo Schlossnagle <jesus@omniti.com> 1337715373 0400
 gitparent:
[9c34eea8305e4339d255aaaef352640ccc879da8]
 gitauthor:
 Theo Schlossnagle <jesus@omniti.com> 1337715373 0400
 Message:
knowing the last known value can also be useful

Files:

Legend:
 Unmodified
 Added
 Removed
 Modified
 Copied
 Moved
rc385b68 
r27a5e33 

152  152  

153  153  /* Next the actual data */ 

154   snprintf(buff, sizeof(buff), "%s`%s", key, 

155   (type == 'c') ? "rate" : (type == 'g') ? "gauge" : "timing"); 

156   m = noit_stats_get_metric(check, &ccl>current, buff); 

157  154  if(type == 'c') { 

158  155  double v = diff * (1.0 / sample) / (check>period / 1000.0); 

 156  snprintf(buff, sizeof(buff), "%s`rate", key); 

 157  m = noit_stats_get_metric(check, &ccl>current, buff); 

159  158  if(m && m>metric_type == METRIC_DOUBLE && m>metric_value.n != NULL) { 

160  159  (*m>metric_value.n) += v; 

…  …  
164  163  noit_stats_set_metric(check, &ccl>current, buff, METRIC_DOUBLE, &v); 

165  164  } 

166   else if(type == 'g'  type == 'm') { 

167   double v = diff; 

168   if(m && m>metric_type == METRIC_DOUBLE && m>metric_value.n != NULL) { 

169   (*m>metric_value.n) = v; 

170   check_stats_set_metric_hook_invoke(check, &ccl>current, m); 

171   } 

172   else 

173   noit_stats_set_metric(check, &ccl>current, buff, METRIC_DOUBLE, &v); 

174   } 

 165  

 166  snprintf(buff, sizeof(buff), "%s`%s", key, 

 167  (type == 'c') ? "counter" : (type == 'g') ? "gauge" : "timing"); 

 168  m = noit_stats_get_metric(check, &ccl>current, buff); 

 169  if(m && m>metric_type == METRIC_DOUBLE && m>metric_value.n != NULL) { 

 170  (*m>metric_value.n) = diff; 

 171  check_stats_set_metric_hook_invoke(check, &ccl>current, m); 

 172  } 

 173  else 

 174  noit_stats_set_metric(check, &ccl>current, buff, METRIC_DOUBLE, &diff); 

175  175  } 

176  176  
