Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dslx): allow running w/o measurexlite as the backend #1376

Merged
merged 6 commits into from
Oct 20, 2023

Conversation

bassosimone
Copy link
Member

@bassosimone bassosimone commented Oct 20, 2023

Summary of the changes:

  • rename ConnPool (struct) to Runtime (interface) and retain the same functionality;

  • introduce a "minimal" runtime that does not collect observations along with a measurexlite runtime;

  • use the "runtime" to carry the logger and other bits of information that it seems more rational to keep into the runtime rather than keeping inside each pipeline stage result (I also did this in the richer-input PoC);

  • make sure measurexlite's Trace can be fully accessed through an interface.

Closes ooni/probe#2580

We want to use the DSL inside the oohelperd. We don't care about
collecting observations in the oohelperd. So, the plan is that of
abstracting the ConnPool, renaming it Runtime, and giving it the
power to create abstract Traces.

The oohelperd will use a MinimalRuntime (sketched out by this
commit) that will not collect any observation.

Measuring code, instead, will use a MeasurexRuntime that will
collect observations.

This commit is just the first step. We rename and introduce the
MinimalRuntime. No significant functional changes so far.
This diff builds on the previous diff and uses an abstract trace
inside of the dslx package. By using an abstract trace, we can
choose between using:

- a runtime that collects observations, based on measurexlite; and

- a minimal runtime that does not collect observations.

To make the trace abstract, we need to modify measurexlite's trace
such that it can be used as an interface.

In turn, this means we need to update the throttling package
such that it uses an abstract trace definition. Strictly speaking,
we could have avoided introducing this abstraction, but it seems
better to also use an abstract trace there, as it allows for
improving the decoupling with measurexlite.
Currently, we pass these fields to each DSL function. However, if
we want to load the functions from JSON, which is something we have
experimented with in the richer input context, we can't do this.

These fields should instead belong to the runtime. A subsequent diff
will modify the DSL functions to take them from the runtime.
This diff builds upon the previous diff to use the Runtime to get
the logger, ID generator, and zero time.

By doing this, we make most structures that DSL functions takes
as input or emit in output serializable and deserializable.
internal/dslx/tls.go Outdated Show resolved Hide resolved
@bassosimone bassosimone changed the title dslx: allow running w/o measurexlite as the backend refactor(dslx): allow running w/o measurexlite as the backend Oct 20, 2023
@bassosimone
Copy link
Member Author

Something seems to have changed in the OONI -test backend, which causes alltests to fail.

I will investigate at a later time, since it may just be a transient issue.

@bassosimone bassosimone merged commit 2da2e4d into master Oct 20, 2023
7 of 10 checks passed
@bassosimone bassosimone deleted the issue/2545-small branch October 20, 2023 12:04
Murphy-OrangeMud pushed a commit to Murphy-OrangeMud/probe-cli that referenced this pull request Feb 13, 2024
)

Summary of the changes:

* rename `ConnPool` (`struct`) to `Runtime` (`interface`) and retain the
same functionality;

* introduce a "minimal" runtime that does not collect observations along
with a measurexlite runtime;

* use the "runtime" to carry the logger and other bits of information
that it seems more rational to keep into the runtime rather than keeping
inside each pipeline stage result (I also did this in the richer-input
PoC);

* make sure `measurexlite`'s `Trace` can be fully accessed through an
interface.

Closes ooni/probe#2580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant