Skip to content

Commit

Permalink
Merge pull request #620 from ooni/oonirun/add-run-id-to-anotations
Browse files Browse the repository at this point in the history
Adds `ooni_run_link_id` to annotations
  • Loading branch information
aanorbel authored Oct 11, 2023
2 parents 368b509 + c0d34c2 commit c152544
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public OONIRunSuite getTestSuite(Context context) {
for (String url : nettest.getInputs())
Url.checkExistingUrl(url);
}
test.setOoniRunLinkId(runId);
test.setInputs(nettest.getInputs());
return test;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public void setOrigin(String origin) {
annotations.origin = origin;
}

public void setOoniRunLinkId(Long ooniRunLinkId) {
annotations.ooniRunLinkId = String.valueOf(ooniRunLinkId);
}

private class OONIMKTaskConfigAdapter implements OONIMKTaskConfig {
private String serialized;
private Settings settings;
Expand All @@ -103,6 +107,9 @@ public static class Annotations {
@SerializedName("origin")
public String origin;

@SerializedName("ooni_run_link_id")
public String ooniRunLinkId;

public Annotations(Context c) {
this.network_type = ReachabilityManager.getNetworkType(c);
this.flavor = BuildConfig.FLAVOR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public abstract class AbstractTest implements Serializable {
private final int urlResId;
private final int runtime;
private List<String> inputs;
private Long ooniRunLinkId;
private Integer max_runtime;
private Network network;

Expand Down Expand Up @@ -81,6 +82,9 @@ void run(Context c, PreferenceManager pm, AppLogger logger, Gson gson, Settings
settings.inputs = inputs;
settings.setMaxRuntime(max_runtime);
settings.setOrigin(origin);
if (ooniRunLinkId != null && ooniRunLinkId > 0) {
settings.setOoniRunLinkId(ooniRunLinkId);
}
measurements = new SparseArray<>();

ThirdPartyServices.addLogExtra("settings", ((Application) c.getApplicationContext()).getGson().toJson(settings));
Expand Down Expand Up @@ -349,7 +353,11 @@ public void setInputs(List<String> inputs) {
this.inputs = inputs;
}

public Integer getMax_runtime() {
public void setOoniRunLinkId(Long ooniRunLinkId) {
this.ooniRunLinkId = ooniRunLinkId;
}

public Integer getMax_runtime() {
return max_runtime;
}

Expand Down

0 comments on commit c152544

Please sign in to comment.