[JS][Java] Mix in sample unit and rate
... for events submitted using MetricsClient#dispatch() (JS) and MetricsClient#submitMetricsEvent() (Java).
Notes
JS: ~
Java
- Add a
sampleproperty to.event.Event, which introduces a circular dependency between the.eventand.configpackages - Resolve that circular dependency by removing the dependency on the
.eventpackage from the.configpackage by extractingCurationControllerfrom.config.CurationFilterand.curation.*Rules - Dramatically reduce cyclomatic and NPath complexity of
CurationController#shouldProduceEvent()by converting the repeatedifblocks 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