Bosun: How to handle empty number sets with ungroup? -


i'm trying setup bosun , graphite alert on error ratio, compiled 2 different sources: api traffic , web app traffic. here's have now:

$web_rate = avg(graphite("sumseries(collectd.*.statsd.web.*.rate)", "5m", "", "")) $api_rate = avg(graphite("sumseries(collectd.*.statsd.api.*.rate)", "5m", "", "")) $web_error_rate = avg(graphite("sumseries(collectd.*.statsd.web.*.errorrate)", "5m", "", "")) $api_error_rate = avg(graphite("sumseries(collectd.*.statsd.api.*.errorrate)", "5m", "", ""))   $total_rate = ungroup($web_rate) + ungroup($api_rate) $total_error_rate = ungroup($web_error_rate) + ungroup(api_error_rate)  $error_ratio = $total_error_rate / $total_rate 

our counters don't exist in graphite until non-zero, our pre-production environment, above fails following:

ungroup: requires 1 group 

when in expression browser, graphite(...) call returning, expected, empty set result of avg(graphite(...)) displays nothing.

does know how handle this?

in case there no data in graphite metric , specified timeframe, return nan, nothing.

if try ungroup nan, following error:

ungroup: requires 1 group 

use nv function protect error. nv function replace possible nan specified value:

nv($result, 0) 

now can safely ungroup:

ungroup(nv($result, 0)) 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -