All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yammer.telemetry.tracing.Sampling Maven / Gradle / Ivy

The newest version!
package com.yammer.telemetry.tracing;

public abstract class Sampling {
    public static final Sampling ON = new SamplingOn();
    public static final Sampling OFF = new SamplingOff();

    public abstract boolean trace();

    public static Sampling valueOf(String samplerName) {
        if ("off".equalsIgnoreCase(samplerName)) return OFF;
        if ("on".equalsIgnoreCase(samplerName)) return ON;
        return null;
    }

    private static class SamplingOff extends Sampling {
        @Override
        public boolean trace() {
            return false;
        }
    }

    private static class SamplingOn extends Sampling {
        @Override
        public boolean trace() {
            return true;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy