ooni / probe

OONI Probe network measurement tool for detecting internet censorship
https://ooni.org/install
BSD 3-Clause "New" or "Revised" License
750 stars 142 forks source link

dslx: support running w/o measurexlite #2580

Closed bassosimone closed 8 months ago

bassosimone commented 8 months ago

The current dslx design requires measurexlite. We want to use the dslx package in the Web Connectivity Test Helper, so that we run the ~same code in the probes and in the backend. However, there is no point in using measurexlite in such a case, given that we don't need to collect observations. Because we know from past experience that the Web Connectivity Test Helper may use excessive CPU and memory (see https://github.com/ooni/probe/issues/2413), it makes sense to avoid collecting observations for such a user case. Besides, the work to support running w/o measurexlite reduces the coupling between components and potentially allows for better unit testing. In fact, all is required to do to make this improvement possible is to ensure that *measurexlite.Trace is mockable. To this end, we need to transform public fields into accessors.

An additional reason why I would like to implement this change is the following. We already support a throttling measurement methodology for Web Connectivity LTE (reference issue: https://github.com/ooni/ooni.org/issues/1296), but all the other experiments do not support it, because they're not based on the measurexlite backend. Also, writing experiments code directly using measurexlite is difficult, hence dslx. However, the dslx package still requires some amount of engineering and maintenance before being used. There are open questions about its design that emerged while exploring the richer input strategy based on using a DSL (see https://github.com/ooni/2023-05-richer-input). Having spent time on such a task, I have learned from experience and know which changes to apply. In fact, the diff I am about to apply here derives from work I did as part of richer input, where I understood how to shuffle things around to make DSL code more useful.