Improvements to the list output

This commit is contained in:
Arturo Filastò 2018-09-11 15:19:08 +02:00
parent 66ffbde270
commit 31ccb1c181
3 changed files with 14 additions and 8 deletions

View File

@ -118,6 +118,8 @@ func CreateMeasurement(sess sqlbuilder.Database, reportID sql.NullString, testNa
ResultID: resultID,
ReportFilePath: reportFilePath,
URLID: urlID,
IsFailed: false,
IsDone: false,
// XXX Do we want to have this be part of something else?
StartTime: time.Now().UTC(),
TestKeys: "",

View File

@ -25,6 +25,8 @@ type MeasurementURLNetwork struct {
MsmtTblID int64 `db:"msmt_tbl_id"`
Network `db:",inline"`
NetworkID int64 `db:"network_id"`
Result `db:",inline"`
ResultID int64 `db:"result_id"`
URL `db:",inline"`
}
@ -54,7 +56,7 @@ type Measurement struct {
Runtime float64 `db:"runtime"` // Fractional number of seconds
IsDone bool `db:"is_done"`
IsUploaded bool `db:"is_uploaded"`
IsFailed string `db:"is_failed"`
IsFailed bool `db:"is_failed"`
FailureMsg sql.NullString `db:"failure_msg,omitempty"`
IsUploadFailed bool `db:"is_upload_failed"`
UploadFailureMsg sql.NullString `db:"upload_failure_msg,omitempty"`
@ -101,6 +103,7 @@ func (r *Result) Finished(sess sqlbuilder.Database) error {
// Failed writes the error string to the measurement
func (m *Measurement) Failed(sess sqlbuilder.Database, failure string) error {
m.FailureMsg = sql.NullString{String: failure, Valid: true}
m.IsFailed = true
err := sess.Collection("measurements").Find("id", m.ID).Update(m)
if err != nil {
return errors.Wrap(err, "updating measurement")

View File

@ -26,22 +26,23 @@ func MeasurementItem(msmt database.MeasurementURLNetwork) {
"type": "measurement_item",
"id": msmt.MsmtTblID,
"test_name": msmt.TestName,
"start_time": msmt.StartTime,
"test_group_name": msmt.Result.TestGroupName,
"start_time": msmt.Measurement.StartTime,
"test_keys": msmt.TestKeys,
"probe_cc": msmt.Network.CountryCode,
"network_name": msmt.Network.NetworkName,
"asn": msmt.Network.ASN,
"runtime": msmt.Runtime,
"url": msmt.URL.URL,
"url_category_code": msmt.URL.CategoryCode,
"url_country_code": msmt.URL.CountryCode,
"is_anomaly": msmt.IsAnomaly,
"runtime": msmt.Measurement.Runtime,
"url": msmt.URL.URL.String,
"url_category_code": msmt.URL.CategoryCode.String,
"url_country_code": msmt.URL.CountryCode.String,
"is_anomaly": msmt.IsAnomaly.Bool,
"is_uploaded": msmt.IsUploaded,
"is_upload_failed": msmt.IsUploadFailed,
"upload_failure_msg": msmt.UploadFailureMsg.String,
"is_failed": msmt.IsFailed,
"failure_msg": msmt.FailureMsg.String,
"is_done": msmt.IsDone,
"is_done": msmt.Measurement.IsDone,
"report_file_path": msmt.ReportFilePath,
}).Info("measurement")
}