fix(websteps): use correct input for each URL measurement (#536)

Closes https://github.com/ooni/probe/issues/1798
This commit is contained in:
Simone Basso 2021-10-05 12:29:00 +02:00 committed by GitHub
parent 9b52a050ba
commit 3f511d100b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -128,6 +128,7 @@ func (eaw *experimentAsyncWrapper) RunAsync(
defer close(out) // signal the reader we're done!
out <- &model.ExperimentAsyncTestKeys{
Extensions: measurement.Extensions,
Input: measurement.Input,
MeasurementRuntime: stop.Sub(start).Seconds(),
TestKeys: measurement.TestKeys,
}
@ -177,6 +178,7 @@ func (e *Experiment) MeasureAsync(
for tk := range in {
measurement := e.newMeasurement(input)
measurement.Extensions = tk.Extensions
measurement.Input = tk.Input
measurement.MeasurementRuntime = tk.MeasurementRuntime
measurement.TestKeys = tk.TestKeys
if err := measurement.Scrub(e.session.ProbeIP()); err != nil {

View File

@ -133,8 +133,6 @@ func (mx *Measurer) runAsync(ctx context.Context, sess model.ExperimentSession,
ctx, URL, measurex.NewHTTPRequestHeaderForMeasuring(), cookies)
for m := range in {
out <- &model.ExperimentAsyncTestKeys{
MeasurementRuntime: m.TotalRuntime.Seconds(),
TestKeys: &TestKeys{URLMeasurement: m},
Extensions: map[string]int64{
archival.ExtHTTP.Name: archival.ExtHTTP.V,
archival.ExtDNS.Name: archival.ExtDNS.V,
@ -142,6 +140,9 @@ func (mx *Measurer) runAsync(ctx context.Context, sess model.ExperimentSession,
archival.ExtTCPConnect.Name: archival.ExtTCPConnect.V,
archival.ExtTLSHandshake.Name: archival.ExtTLSHandshake.V,
},
Input: model.MeasurementTarget(m.URL),
MeasurementRuntime: m.TotalRuntime.Seconds(),
TestKeys: &TestKeys{URLMeasurement: m},
}
}
}

View File

@ -24,14 +24,17 @@ type ExperimentSession interface {
// ExperimentAsyncTestKeys is the type of test keys returned by an experiment
// when running in async fashion rather than in sync fashion.
type ExperimentAsyncTestKeys struct {
// Extensions contains the extensions used by this experiment.
Extensions map[string]int64
// Input is the input this measurement refers to.
Input MeasurementTarget
// MeasurementRuntime is the total measurement runtime.
MeasurementRuntime float64
// TestKeys contains the actual test keys.
TestKeys interface{}
// Extensions contains the extensions used by this experiment.
Extensions map[string]int64
}
// ExperimentMeasurerAsync is a measurer that can run in async fashion.