CREATE CONTINUOUS QUERY rate_m ON tengine BEGIN SELECT (non_negative_derivative(last(http_2xx), 1s) + 0.001) / (non_negative_derivative(last(req_total), 1s) + 0.001) AS rate_2xx, non_negative_derivative(last(http_4xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_4xx, non_negative_derivative(last(http_5xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_5xx, non_negative_derivative(last(http_3xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_3xx, non_negative_derivative(last(http_499), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_499, non_negative_derivative(last(http_404), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_404, non_negative_derivative(last(http_500), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_500, non_negative_derivative(last(http_502), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_502, non_negative_derivative(last(http_503), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_503, non_negative_derivative(last(http_504), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_504 INTO tengine."default".rate_m_reqstat FROM tengine."default".reqstat GROUP BY time(5m), cluster, server, app END
CREATE CONTINUOUS QUERY rate_h ON tengine BEGIN SELECT (non_negative_derivative(last(http_2xx), 1s) + 0.001) / (non_negative_derivative(last(req_total), 1s) + 0.001) AS rate_2xx, non_negative_derivative(last(http_4xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_4xx, non_negative_derivative(last(http_5xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_5xx, non_negative_derivative(last(http_3xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_3xx, non_negative_derivative(last(http_499), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_499, non_negative_derivative(last(http_404), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_404, non_negative_derivative(last(http_500), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_500, non_negative_derivative(last(http_502), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_502, non_negative_derivative(last(http_503), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_503, non_negative_derivative(last(http_504), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_504 INTO tengine.trend_365.rate_h_reqstat FROM tengine."default".reqstat GROUP BY time(1h), cluster, server, app END
CREATE CONTINUOUS QUERY rate_d ON tengine BEGIN SELECT (non_negative_derivative(last(http_2xx), 1s) + 0.001) / (non_negative_derivative(last(req_total), 1s) + 0.001) AS rate_2xx, non_negative_derivative(last(http_4xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_4xx, non_negative_derivative(last(http_5xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_5xx, non_negative_derivative(last(http_3xx), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_3xx, non_negative_derivative(last(http_499), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_499, non_negative_derivative(last(http_404), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_404, non_negative_derivative(last(http_500), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_500, non_negative_derivative(last(http_502), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_502, non_negative_derivative(last(http_503), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_503, non_negative_derivative(last(http_504), 1s) / non_negative_derivative(last(req_total), 1s) AS rate_504 INTO tengine.trend_365.rate_d_reqstat FROM tengine."default".reqstat GROUP BY time(1d), cluster, server, app END