Beispiel #1
0
// Report statisfies the Statement Interface
func (i *InsertStatement) Report(s *ponyExpress.StoreFront) string {
	// Pull data via StoreFront client
	allData := s.GetStatementResults(i.StatementID, "write")

	if allData == nil || allData[0].Series == nil {
		log.Fatalf("No data returned for write report\n  Statement Name: %v\n  Statement ID: %v\n", i.Name, i.StatementID)
	}

	ir := &insertReport{
		name:    i.Name,
		columns: allData[0].Series[0].Columns,
		values:  allData[0].Series[0].Values,
	}

	responseTimes := responseTimes(ir.columns, ir.values)

	ir.percentile = percentile(responseTimes)
	ir.avgResponseTime = avgDuration(responseTimes)
	ir.stdDevResponseTime = stddevDuration(responseTimes)
	ir.pointsPerSecond = int(float64(i.Timestamp.Count) / i.runtime.Seconds())
	ir.numRetries = countRetries(ir.columns, ir.values)
	ir.successfulWrites = countSuccesses(ir.columns, ir.values)
	ir.avgRequestBytes = numberBytes(ir.columns, ir.values)

	return ir.String()
}
Beispiel #2
0
// Report statisfies the Statement Interface
// No test coverage, fix
func (i *InfluxqlStatement) Report(s *ponyExpress.StoreFront) (out string) {
	allData := s.GetStatementResults(i.StatementID, "query")

	iqlr := &influxQlReport{
		statement: i.Query,
		columns:   allData[0].Series[0].Columns,
		values:    allData[0].Series[0].Values,
	}

	iqlr.responseTime = time.Duration(responseTimes(iqlr.columns, iqlr.values)[0].Value)

	switch countSuccesses(iqlr.columns, iqlr.values) {
	case 0:
		iqlr.success = false
	case 1:
		iqlr.success = true
	default:
		log.Fatal("Error fetching response for InfluxQL statement")
	}

	return iqlr.String()
}
Beispiel #3
0
// Report statisfies the Statement Interface
func (i *QueryStatement) Report(s *ponyExpress.StoreFront) string {
	// Pull data via StoreFront client
	allData := s.GetStatementResults(i.StatementID, "query")

	if len(allData) == 0 || allData[0].Series == nil {
		log.Fatalf("No data returned for query report\n  Statement Name: %v\n  Statement ID: %v\n", i.Name, i.StatementID)
	}

	qr := &queryReport{
		name:    i.Name,
		columns: allData[0].Series[0].Columns,
		values:  allData[0].Series[0].Values,
	}

	responseTimes := responseTimes(qr.columns, qr.values)

	qr.percentile = percentile(responseTimes)
	qr.avgResponseTime = avgDuration(responseTimes)
	qr.stdDevResponseTime = stddevDuration(responseTimes)
	qr.successfulReads = countSuccesses(qr.columns, qr.values)
	qr.responseBytes = numberBytes(qr.columns, qr.values)

	return qr.String()
}