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, ResultID: resultID,
ReportFilePath: reportFilePath, ReportFilePath: reportFilePath,
URLID: urlID, URLID: urlID,
IsFailed: false,
IsDone: false,
// XXX Do we want to have this be part of something else? // XXX Do we want to have this be part of something else?
StartTime: time.Now().UTC(), StartTime: time.Now().UTC(),
TestKeys: "", TestKeys: "",

View File

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

View File

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