Skip to content

[JS][Java] Mix in sample unit and rate

Phuedx requested to merge work/phuedx/T310693 into main

... for events submitted using MetricsClient#dispatch() (JS) and MetricsClient#submitMetricsEvent() (Java).

Notes

JS: ~

Java

  • Add a sample property to .event.Event, which introduces a circular dependency between the .event and .config packages
  • Resolve that circular dependency by removing the dependency on the .event package from the .config package by extracting CurationController from .config.CurationFilter and .curation.*Rules
  • Dramatically reduce cyclomatic and NPath complexity of CurationController#shouldProduceEvent() by converting the repeated if blocks to generic, small (often inline) functions, e.g.
if (rules.getEqualsRule() != null && value.equals(rules.getEqualsRule()) {
  return false;
}

// Is converted to:

return applyEqualsRule(rules.getEqualsRule(), value);

// ...

private static <T> function applyEqualsRule(T rule, @lombok.NonNull T value) {
  return rule == null || rule.equals(value);
}
  • Finally, simplify all classes that represent curation config by annotating them with @lombok.Value

Bug: T310693

Bug: T330473

Edited by Phuedx

Merge request reports