func statsOK() *memmetrics.RTMetrics { m, err := memmetrics.NewRTMetrics() if err != nil { panic(err) } return m }
func statsLatencyAtQuantile(quantile float64, value time.Duration) *memmetrics.RTMetrics { m, err := memmetrics.NewRTMetrics() if err != nil { panic(err) } m.Record(http.StatusOK, value) return m }
func statsResponseCodes(codes ...statusCode) *memmetrics.RTMetrics { m, err := memmetrics.NewRTMetrics() if err != nil { panic(err) } for _, c := range codes { for i := int64(0); i < c.Count; i++ { m.Record(c.Code, 0) } } return m }
func statsNetErrors(threshold float64) *memmetrics.RTMetrics { m, err := memmetrics.NewRTMetrics() if err != nil { panic(err) } for i := 0; i < 100; i++ { if i < int(threshold*100) { m.Record(http.StatusGatewayTimeout, 0) } else { m.Record(http.StatusOK, 0) } } return m }