Changeset 8ec2899c1ccf6cfc70b418c6e91761e24c5de8cd
- Timestamp:
- 05/31/12 03:15:23
(1 year ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1338434123 -0400
- git-parent:
[01c98d2a7a4abe4ad1e76a475e64bd6632749cbc]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1338434123 -0400
- Message:
don't immediate log all array subvalues -- that can be super-large
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r8519251 |
r8ec2899 |
|
| 248 | 248 | static int |
|---|
| 249 | 249 | httptrap_yajl_cb_end_map(void *ctx) { |
|---|
| 250 | | struct value_list *p; |
|---|
| | 250 | struct value_list *p, *last_p = NULL; |
|---|
| 251 | 251 | struct rest_json_payload *json = ctx; |
|---|
| 252 | 252 | json->depth--; |
|---|
| 253 | 253 | if(json->saw_complex_type == 0x3) { |
|---|
| | 254 | long double total = 0, cnt = 0; |
|---|
| | 255 | bool use_avg = false; |
|---|
| 254 | 256 | for(p=json->last_value;p;p=p->next) { |
|---|
| 255 | 257 | noit_stats_set_metric_coerce(json->check, json->stats, |
|---|
| 256 | 258 | json->keys[json->depth], json->last_type, p->v); |
|---|
| 257 | | if(json->immediate) |
|---|
| | 259 | last_p = p; |
|---|
| | 260 | if(json->last_type == 'L' || json->last_type == 'l' || |
|---|
| | 261 | json->last_type == 'I' || json->last_type == 'i' || |
|---|
| | 262 | json->last_type == 'n') { |
|---|
| | 263 | total += strtold(p->v, NULL); |
|---|
| | 264 | cnt = cnt + 1; |
|---|
| | 265 | use_avg = true; |
|---|
| | 266 | } |
|---|
| | 267 | json->cnt++; |
|---|
| | 268 | } |
|---|
| | 269 | if(json->immediate && last_p != NULL) { |
|---|
| | 270 | if(use_avg) { |
|---|
| | 271 | double avg = total / cnt; |
|---|
| 258 | 272 | noit_stats_log_immediate_metric(json->check, |
|---|
| 259 | | json->keys[json->depth], json->last_type, p->v); |
|---|
| 260 | | json->cnt++; |
|---|
| | 273 | json->keys[json->depth], 'n', &avg); |
|---|
| | 274 | } |
|---|
| | 275 | else { |
|---|
| | 276 | noit_stats_log_immediate_metric(json->check, |
|---|
| | 277 | json->keys[json->depth], json->last_type, last_p->v); |
|---|
| | 278 | } |
|---|
| 261 | 279 | } |
|---|
| 262 | 280 | } |
|---|