
com.wavefront.agent.sampler.SpanSamplerUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proxy Show documentation
Show all versions of proxy Show documentation
Service for batching and relaying metric traffic to Wavefront
package com.wavefront.agent.sampler;
import com.wavefront.sdk.entities.tracing.sampling.DurationSampler;
import com.wavefront.sdk.entities.tracing.sampling.RateSampler;
import com.wavefront.sdk.entities.tracing.sampling.Sampler;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
/**
* Helper class for creating span samplers.
*
* @author Vikram Raman ([email protected])
*/
public class SpanSamplerUtils {
@Nullable
public static Sampler getRateSampler(double rate) {
if (rate < 0.0 || rate >= 1.0) {
return null;
}
return new RateSampler(rate);
}
@Nullable
public static Sampler getDurationSampler(int duration) {
if (duration == 0) {
return null;
}
return new DurationSampler(duration);
}
@Nullable
public static List fromSamplers(Sampler... samplers) {
if (samplers == null || samplers.length == 0) {
return null;
}
return Arrays.stream(samplers).filter(Objects::nonNull).collect(Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy