Search in sources :

Example 1 with SamplerFactory

use of com.navercorp.pinpoint.profiler.sampler.SamplerFactory in project pinpoint by naver.

the class SamplerFactoryTest method createSamplerSamplingRate_Negative.

@Test
public void createSamplerSamplingRate_Negative() {
    SamplerFactory samplerFactory = new SamplerFactory();
    Sampler sampler = samplerFactory.createSampler(true, -1);
    boolean sampling = sampler.isSampling();
    Assert.assertFalse(sampling);
}
Also used : SamplerFactory(com.navercorp.pinpoint.profiler.sampler.SamplerFactory) Sampler(com.navercorp.pinpoint.bootstrap.sampler.Sampler) Test(org.junit.Test)

Example 2 with SamplerFactory

use of com.navercorp.pinpoint.profiler.sampler.SamplerFactory in project pinpoint by naver.

the class SamplerProvider method get.

@Override
public Sampler get() {
    boolean samplingEnable = profilerConfig.isSamplingEnable();
    int samplingRate = profilerConfig.getSamplingRate();
    SamplerFactory samplerFactory = new SamplerFactory();
    return samplerFactory.createSampler(samplingEnable, samplingRate);
}
Also used : SamplerFactory(com.navercorp.pinpoint.profiler.sampler.SamplerFactory)

Example 3 with SamplerFactory

use of com.navercorp.pinpoint.profiler.sampler.SamplerFactory in project pinpoint by naver.

the class SamplerProvider method get.

@Override
public Sampler get() {
    SamplerConfig config = new SamplerConfig(profilerConfig);
    logger.info("SamplerConfig:{}", config);
    if (!config.isSamplingEnable()) {
        return FalseSampler.INSTANCE;
    }
    SamplerType samplerType = config.getSamplerType();
    SamplerFactory samplerFactory = newSamplerFactory(samplerType, profilerConfig);
    return samplerFactory.createSampler();
}
Also used : SamplerFactory(com.navercorp.pinpoint.profiler.sampler.SamplerFactory) PercentSamplerFactory(com.navercorp.pinpoint.profiler.sampler.PercentSamplerFactory) CountingSamplerFactory(com.navercorp.pinpoint.profiler.sampler.CountingSamplerFactory) SamplerType(com.navercorp.pinpoint.profiler.sampler.SamplerType)

Example 4 with SamplerFactory

use of com.navercorp.pinpoint.profiler.sampler.SamplerFactory in project pinpoint by naver.

the class SamplerFactoryTest method createSamplerSamplingRate0.

@Test
public void createSamplerSamplingRate0() {
    SamplerFactory samplerFactory = new SamplerFactory();
    Sampler sampler = samplerFactory.createSampler(true, 0);
    boolean sampling = sampler.isSampling();
    Assert.assertFalse(sampling);
}
Also used : SamplerFactory(com.navercorp.pinpoint.profiler.sampler.SamplerFactory) Sampler(com.navercorp.pinpoint.bootstrap.sampler.Sampler) Test(org.junit.Test)

Aggregations

SamplerFactory (com.navercorp.pinpoint.profiler.sampler.SamplerFactory)4 Sampler (com.navercorp.pinpoint.bootstrap.sampler.Sampler)2 Test (org.junit.Test)2 CountingSamplerFactory (com.navercorp.pinpoint.profiler.sampler.CountingSamplerFactory)1 PercentSamplerFactory (com.navercorp.pinpoint.profiler.sampler.PercentSamplerFactory)1 SamplerType (com.navercorp.pinpoint.profiler.sampler.SamplerType)1