Add result testkeys projection
This commit is contained in:
parent
73fafacc2c
commit
898332064b
|
@ -41,7 +41,6 @@ func init() {
|
||||||
output.SectionTitle("Incomplete results")
|
output.SectionTitle("Incomplete results")
|
||||||
}
|
}
|
||||||
for idx, result := range incompleteResults {
|
for idx, result := range incompleteResults {
|
||||||
|
|
||||||
output.ResultItem(output.ResultItemData{
|
output.ResultItem(output.ResultItemData{
|
||||||
ID: result.Result.ID,
|
ID: result.Result.ID,
|
||||||
Index: idx,
|
Index: idx,
|
||||||
|
@ -68,6 +67,10 @@ func init() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Error("failed to list measurement counts")
|
log.WithError(err).Error("failed to list measurement counts")
|
||||||
}
|
}
|
||||||
|
testKeys, err := database.GetResultTestKeys(ctx.DB, result.Result.ID)
|
||||||
|
if err != nil {
|
||||||
|
log.WithError(err).Error("failed to get testKeys")
|
||||||
|
}
|
||||||
output.ResultItem(output.ResultItemData{
|
output.ResultItem(output.ResultItemData{
|
||||||
ID: result.Result.ID,
|
ID: result.Result.ID,
|
||||||
Index: idx,
|
Index: idx,
|
||||||
|
@ -77,7 +80,7 @@ func init() {
|
||||||
NetworkName: result.Network.NetworkName,
|
NetworkName: result.Network.NetworkName,
|
||||||
Country: result.Network.CountryCode,
|
Country: result.Network.CountryCode,
|
||||||
ASN: fmt.Sprintf("AS%d", result.Network.ASN),
|
ASN: fmt.Sprintf("AS%d", result.Network.ASN),
|
||||||
TestKeys: "{}", // FIXME this used to be Summary we probably need to use a list now
|
TestKeys: testKeys,
|
||||||
MeasurementCount: totalCount,
|
MeasurementCount: totalCount,
|
||||||
MeasurementAnomalyCount: anmlyCount,
|
MeasurementAnomalyCount: anmlyCount,
|
||||||
Done: result.IsDone,
|
Done: result.IsDone,
|
||||||
|
|
|
@ -37,6 +37,24 @@ func ListMeasurements(sess sqlbuilder.Database, resultID int64) ([]MeasurementUR
|
||||||
return measurements, nil
|
return measurements, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetResultTestKeys returns a list of TestKeys for a given measurements
|
||||||
|
func GetResultTestKeys(sess sqlbuilder.Database, resultID int64) (string, error) {
|
||||||
|
res := sess.Collection("measurements").Find("result_id", resultID)
|
||||||
|
defer res.Close()
|
||||||
|
|
||||||
|
var msmt Measurement
|
||||||
|
for res.Next(&msmt) {
|
||||||
|
if msmt.TestName == "web_connectivity" {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// We only really care about the NDT TestKeys
|
||||||
|
if msmt.TestName == "ndt" {
|
||||||
|
return msmt.TestKeys, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "{}", nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetMeasurementCounts returns the number of anomalous and total measurement for a given result
|
// GetMeasurementCounts returns the number of anomalous and total measurement for a given result
|
||||||
func GetMeasurementCounts(sess sqlbuilder.Database, resultID int64) (uint64, uint64, error) {
|
func GetMeasurementCounts(sess sqlbuilder.Database, resultID int64) (uint64, uint64, error) {
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user