fix NPE when no filter or validator applied

This commit is contained in:
Jonathan Shook 2023-09-10 19:17:45 -05:00
parent 17fa8500ab
commit 7b9f4389b8
2 changed files with 4 additions and 4 deletions

View File

@ -122,8 +122,8 @@ public class Annotators {
}
public static synchronized void recordAnnotation(Annotation annotation) {
annotation.applyLabelFunction(filter);
annotation.applyLabelFunction(validator);
if (filter!=null) annotation.applyLabelFunction(filter);
if (validator!=null) annotation.applyLabelFunction(validator);
// sanity check here first
annotation.getLabels();
for (Annotator annotator : getAnnotators()) {

View File

@ -76,8 +76,8 @@ public class ActivityMetrics {
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
private static Metric register(NBLabels labels, MetricProvider metricProvider) {
labels = labelFilter.apply(labels);
labels = labelValidator.apply(labels);
labels = labelFilter!=null ? labelFilter.apply(labels) : labels;
labels = labelValidator != null ? labelValidator.apply(labels) : labels;
final String graphiteName = labels.linearizeValues('.',"[activity]","[space]","[op]","name");
Metric metric = get().getMetrics().get(graphiteName);