zipkin2.internal.FilterTraces Maven / Gradle / Ivy
/*
* Copyright The OpenZipkin Authors
* SPDX-License-Identifier: Apache-2.0
*/
package zipkin2.internal;
import java.util.ArrayList;
import java.util.List;
import zipkin2.Call;
import zipkin2.Span;
import zipkin2.storage.QueryRequest;
public final class FilterTraces implements Call.Mapper>, List>> {
/** Filters the mutable input based on the query */
public static Call.Mapper>, List>> create(QueryRequest request) {
return new FilterTraces(request);
}
final QueryRequest request;
FilterTraces(QueryRequest request) {
this.request = request;
}
@Override public List> map(List> input) {
int length = input.size();
if (length == 0) return input;
ArrayList> result = new ArrayList<>(length);
for (List next : input) {
if (request.test(next)) result.add(next);
}
return result;
}
@Override public String toString() {
return "FilterTraces{request=" + request + "}";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy