diff --git a/ndt7/model/archivaldata.go b/ndt7/model/archivaldata.go index 7d09525e..01b96998 100644 --- a/ndt7/model/archivaldata.go +++ b/ndt7/model/archivaldata.go @@ -16,6 +16,16 @@ type ArchivalData struct { ServerMeasurements []Measurement ClientMeasurements []Measurement ClientMetadata []metadata.NameValue `json:",omitempty"` + PingMeasurements []PingMeasurement +} + +// PingMeasurement is a ping measurement. +type PingMeasurement struct { + // RTT is the app-level RTT in millisecond. + RTT int64 + + // ElapsedTime is the elapsed time in microseconds. + ElapsedTime int64 } // The Measurement struct contains measurement results. This structure is diff --git a/ndt7/receiver/receiver.go b/ndt7/receiver/receiver.go index 7a586fcb..7c48e3b9 100644 --- a/ndt7/receiver/receiver.go +++ b/ndt7/receiver/receiver.go @@ -26,6 +26,8 @@ func start( ctx context.Context, conn *websocket.Conn, kind receiverKind, data *model.ArchivalData, ) { + // TODO(bassosimone): use a uniform definition of "beginning of time" + begin := time.Now() logging.Logger.Debug("receiver: start") proto := ndt7metrics.ConnLabel(conn) defer logging.Logger.Debug("receiver: stop") @@ -44,6 +46,10 @@ func start( if err == nil { rtt /= int64(time.Millisecond) logging.Logger.Debugf("receiver: ApplicationLevel RTT: %d ms", rtt) + data.PingMeasurements = append(data.PingMeasurements, model.PingMeasurement{ + RTT: rtt, + ElapsedTime: int64(time.Since(begin) / time.Microsecond), + }) } else { ndt7metrics.ClientReceiverErrors.WithLabelValues( proto, string(kind), "ping-parse-ticks").Inc()