
com.wavefront.sdk.entities.tracing.sampling.CompositeSampler Maven / Gradle / Ivy
package com.wavefront.sdk.entities.tracing.sampling;
import java.util.List;
/**
* Sampler that delegates to multiple other samplers for sampling.
* The sampling decision is true if any of the delegate samplers allow the span.
*
* @author Vikram Raman ([email protected])
*/
public class CompositeSampler implements Sampler {
private final List samplers;
public CompositeSampler(List samplers) {
this.samplers = samplers;
}
@Override
public boolean sample(String operationName, long traceId, long duration) {
if (samplers == null || samplers.isEmpty()) {
return true;
}
for (Sampler sampler : samplers) {
if (sampler.sample(operationName, traceId, duration)) {
return true;
}
}
return false;
}
@Override
public boolean isEarly() {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy