| | 92 | function set_check_metric(check, name, type, value) |
|---|
| | 93 | if type == 'i' then |
|---|
| | 94 | check.metric_int32(name, value) |
|---|
| | 95 | elseif type == 'I' then |
|---|
| | 96 | check.metric_uint32(name, value) |
|---|
| | 97 | elseif type == 'l' then |
|---|
| | 98 | check.metric_int64(name, value) |
|---|
| | 99 | elseif type == 'L' then |
|---|
| | 100 | check.metric_uint64(name, value) |
|---|
| | 101 | elseif type == 'n' then |
|---|
| | 102 | check.metric_double(name, value) |
|---|
| | 103 | elseif type == 's' then |
|---|
| | 104 | check.metric_string(name, value) |
|---|
| | 105 | else |
|---|
| | 106 | check.metric(name, value) |
|---|
| | 107 | end |
|---|
| | 108 | end |
|---|
| | 109 | |
|---|
| 97 | | cnt = cnt + json_metric(check, prefix and (prefix .. '`' .. k) or k, v) |
|---|
| | 115 | if k == "_type" then has_type = true |
|---|
| | 116 | elseif k == "_value" then has_value = true |
|---|
| | 117 | else cnt = cnt + json_metric(check, prefix and (prefix .. '`' .. k) or k, v) end |
|---|
| | 118 | end |
|---|
| | 119 | if has_type and has_value then |
|---|
| | 120 | set_check_metric(check, prefix, o._type, o._value) |
|---|
| | 121 | cnt = cnt + 1 |
|---|
| 145 | | if type == 'i' then |
|---|
| 146 | | check.metric_int32(prefix .. name, metric and metric:contents()) |
|---|
| 147 | | elseif type == 'I' then |
|---|
| 148 | | check.metric_uint32(prefix .. name, metric and metric:contents()) |
|---|
| 149 | | elseif type == 'l' then |
|---|
| 150 | | check.metric_int64(prefix .. name, metric and metric:contents()) |
|---|
| 151 | | elseif type == 'L' then |
|---|
| 152 | | check.metric_uint64(prefix .. name, metric and metric:contents()) |
|---|
| 153 | | elseif type == 'n' then |
|---|
| 154 | | check.metric_double(prefix .. name, metric and metric:contents()) |
|---|
| 155 | | elseif type == 's' then |
|---|
| 156 | | check.metric_string(prefix .. name, metric and metric:contents()) |
|---|
| 157 | | else |
|---|
| 158 | | check.metric(prefix .. name, metric and metric:contents()) |
|---|
| 159 | | end |
|---|
| | 175 | set_check_metric(prefix .. name, type, metric and metric:contents()) |
|---|