本文整理匯總了Java中com.netflix.servo.monitor.Pollers類的典型用法代碼示例。如果您正苦於以下問題:Java Pollers類的具體用法?Java Pollers怎麽用?Java Pollers使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Pollers類屬於com.netflix.servo.monitor包,在下文中一共展示了Pollers類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
/**
* Start the plugin.
*/
public void start() {
if (!config.isEnabled()) {
LOGGER.info("Atlas Plugin is disabled.");
return;
}
final List<MetricPoller> pollers = Lists.newArrayList();
final MonitorRegistry registry = DefaultMonitorRegistry.getInstance();
final MetricPoller poller = new MonitorRegistryMetricPoller(registry);
pollers.add(poller);
final MetricPoller jvmPoller = new JvmMetricPoller();
pollers.add(jvmPoller);
thePoller = new CompositePoller(pollers);
final long delayForMainPoller = delaySecondsFor(Pollers.getPollingIntervals().get(0));
addPoller(thePoller, delayForMainPoller, TimeUnit.SECONDS);
registry.register(Monitors.newObjectMonitor(observer));
LOGGER.info("Starting to keep track of the cpu usage for threads in the jvm.");
ThreadCpuStats.getInstance().start();
LOGGER.info("Atlas Plugin started.");
}
示例2: getObserver
import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
private MetricObserver getObserver() {
long interval = TimeUnit.MILLISECONDS.toSeconds(Pollers.getPollingIntervals().get(0));
long heartbeat = interval * 2;
if (heartbeat < MIN_HEARTBEAT) {
heartbeat = MIN_HEARTBEAT;
}
MetricObserver o = new NormalizationTransform(atlasObserver, interval, heartbeat, TimeUnit.SECONDS);
return new CounterToRateMetricTransform(o, heartbeat, TimeUnit.SECONDS);
}
示例3: shutdown
import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
/**
* Shutdown the plugin by terminating tasks.
*/
public void shutdown() {
LOGGER.info("Shutting down atlas-client.");
DynamicCounter.increment("atlas.client.shutdown");
executor.shutdownNow();
LOGGER.info("Flushing pending metrics during shutdown");
flushMetrics();
List<Long> pollingIntervals = Pollers.getPollingIntervals();
LOGGER.info("Flushing next set of metrics for main poller.");
ClockWithOffset.INSTANCE.setOffset(pollingIntervals.get(0)); // main poller
flushMetrics();
}
示例4: condAsync
import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
/**
* Create a new observer that will only receive updates if the
* predicate is true. The updates will be processed asynchronously.
*/
public static MetricObserver condAsync(String name, Predicate p,
MetricObserver observer) {
final long expire = Pollers.getPollingIntervals().get(0);
final MetricObserver asyncObserver = new AsyncMetricObserver(
name, observer, ASYNC_QUEUE_SIZE, expire);
return new ConditionalObserver(p, asyncObserver);
}
示例5: BaseAtlasMetricObserver
import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
BaseAtlasMetricObserver(PluginConfig config, RollupConfigurator rollupConfigurator, int pollerIdx) {
this.config = config;
this.stepMs = Pollers.getPollingIntervals().get(pollerIdx);
this.sendTimeoutMs = stepMs * MAX_PERC_TO_SEND / PERCENTAGE;
commonTags = createCommonTagListFromEnvironment();
pushQueue = new LinkedBlockingQueue<>(config.getPushQueueSize());
rollupPolicy = new RollupPolicy(rollupConfigurator);
final Thread pushThread = new Thread(new PushProcessor(), "BaseAtlasMetricObserver-Push");
pushThread.setDaemon(true);
pushThread.start();
}
示例6: getAppliedWindowTime
import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
@Override
public List<Long> getAppliedWindowTime() {
return Pollers.getPollingIntervals();
}
示例7: getPollInterval
import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
/**
* How frequently to poll metrics in seconds and report to observers.
*/
public static long getPollInterval() {
return Pollers.getPollingIntervals().get(0) / 1000L;
}