public String getName() { return sampler.getConfig().getName(); }
public String getName() { return sampler.getConfig().getName(); }
@Override protected void runBootstrapped() { final Set<String> names = new HashSet<>(); names.addAll(samplers); preProcess(); for (final Sampler sampler : bootstrapper.getSamplers()) { if (names.isEmpty() || names.contains(sampler.getConfig().getName())) { SamplerStats.init(); try { process(sampler); } catch (final RuntimeException e) { logger.warn("Sampler threw exception. Ignoring", e); } SamplerStats.unset(); } } postProcess(); }
@Override protected void runBootstrapped() { final Set<String> names = new HashSet<>(); names.addAll(samplers); preProcess(); for (final Sampler sampler : bootstrapper.getSamplers()) { if (names.isEmpty() || names.contains(sampler.getConfig().getName())) { SamplerStats.init(); try { process(sampler); } catch (final RuntimeException e) { logger.warn("Sampler threw exception. Ignoring", e); } SamplerStats.unset(); } } postProcess(); }
private void scheduleSamplers() { for (final Sampler sampler : bootstrapper.getSamplers()) { final SamplerConfig config = sampler.getConfig(); logger.info("Scheduling {} at fixed rate of {} seconds", sampler, config.getInterval()); final SamplerThreadPool threadPool = (SamplerThreadPool) bootstrapper.getSharedResource(sampler.getConfig().getPool()); final SamplerTask task = threadPool.schedule(sampler); tasks.put(config.getName(), task); } } }
private void scheduleSamplers() { for (final Sampler sampler : bootstrapper.getSamplers()) { final SamplerConfig config = sampler.getConfig(); logger.info("Scheduling {} at fixed rate of {} seconds", sampler, config.getInterval()); final SamplerThreadPool threadPool = (SamplerThreadPool) bootstrapper.getSharedResource(sampler.getConfig().getPool()); final SamplerTask task = threadPool.schedule(sampler); tasks.put(config.getName(), task); } } }
@Override public Sampler newSampler(final SamplerConfig config) { for (final LocalObjectFactory factory : objectFactories) { try { if (factory.supportsSampler(config)) { return factory.newSampler(config); } } catch (final RuntimeException e) { throw new ConfigurationException("Failed to create sampler \"" + config.getName() + "\"", e); } } throw new ConfigurationException("Unsupported sampler: " + config); }
@Override public Sampler newSampler(final SamplerConfig config) { for (final LocalObjectFactory factory : objectFactories) { try { if (factory.supportsSampler(config)) { return factory.newSampler(config); } } catch (final RuntimeException e) { throw new ConfigurationException("Failed to create sampler \"" + config.getName() + "\"", e); } } throw new ConfigurationException("Unsupported sampler: " + config); }
@Override public void run() { MDC.put("sampler", sampler.getConfig().getName()); SamplerStats.set(stats); repetitionsLock.lock(); if (repetitions != 0) { try { decrementRemainingRepetitions(); repetitionsLock.unlock(); stats.startSample(); sampler.sample(); stats.endSample(); stats.incSampleSuccessCount(); } catch (final RuntimeException e) { logger.warn("Sampler threw exception. Ignoring.", e); stats.incSampleFailureCount(); stats.endSample(); } } else { repetitionsLock.unlock(); logger.debug("Sampler disabled thus not sampling"); } SamplerStats.unset(); MDC.remove("sampler"); }
@Override public void run() { MDC.put("sampler", sampler.getConfig().getName()); SamplerStats.set(stats); repetitionsLock.lock(); if (repetitions != 0) { try { decrementRemainingRepetitions(); repetitionsLock.unlock(); stats.startSample(); sampler.sample(); stats.endSample(); stats.incSampleSuccessCount(); } catch (final RuntimeException e) { logger.warn("Sampler threw exception. Ignoring.", e); stats.incSampleFailureCount(); stats.endSample(); } } else { repetitionsLock.unlock(); logger.debug("Sampler disabled thus not sampling"); } SamplerStats.unset(); MDC.remove("sampler"); }