func NewExperimentMeasurer(config Config, testName string) model.ExperimentMeasurer {
	return Measurer{config: config, testName: testName}
}
NewExperimentMeasurer creates a new ExperimentMeasurer.
package example
import (
	"context"
	"errors"
	"time"
	"github.com/ooni/probe-engine/model"
)
const testVersion = "0.1.0"
type Config struct {
	Message     string `ooni:"Message to emit at test completion"`
	ReturnError bool   `ooni:"Toogle to return a mocked error"`
	SleepTime   int64  `ooni:"Amount of time to sleep for"`
}
type TestKeys struct {
	Success bool `json:"success"`
}
type Measurer struct {
	config   Config
	testName string
}
func (m Measurer) ExperimentName() string {
	return m.testName
}
func (m Measurer) ExperimentVersion() string {
	return testVersion
}
var ErrFailure = errors.New("mocked error")
func (m Measurer) Run(
	ctx context.Context, sess model.ExperimentSession,
	measurement *model.Measurement, callbacks model.ExperimentCallbacks,
) error {
	var err error
	if m.config.ReturnError {
		err = ErrFailure
	}
	testkeys := &TestKeys{Success: err == nil}
	measurement.TestKeys = testkeys
	sess.Logger().Warnf("%s", "Follow the white rabbit.")
	ctx, cancel := context.WithTimeout(ctx, time.Duration(m.config.SleepTime))
	defer cancel()
	<-ctx.Done()
	sess.Logger().Infof("%s", "Knock, knock, Neo.")
	callbacks.OnProgress(1.0, m.config.Message)
	return err
}