當前位置: 首頁>>代碼示例>>Java>>正文


Java Pollers類代碼示例

本文整理匯總了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.");
}
 
開發者ID:dmuino,項目名稱:atlas-oss-plugin,代碼行數:27,代碼來源:AtlasPlugin.java

示例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);
}
 
開發者ID:dmuino,項目名稱:atlas-oss-plugin,代碼行數:11,代碼來源:AtlasPlugin.java

示例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();
}
 
開發者ID:dmuino,項目名稱:atlas-oss-plugin,代碼行數:18,代碼來源:AtlasPlugin.java

示例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);
}
 
開發者ID:dmuino,項目名稱:atlas-oss-plugin,代碼行數:12,代碼來源:AtlasObservers.java

示例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();
}
 
開發者ID:dmuino,項目名稱:atlas-oss-plugin,代碼行數:12,代碼來源:BaseAtlasMetricObserver.java

示例6: getAppliedWindowTime

import com.netflix.servo.monitor.Pollers; //導入依賴的package包/類
@Override
public List<Long> getAppliedWindowTime() {
  return Pollers.getPollingIntervals();
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:5,代碼來源:DefaultDataSource.java

示例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;
}
 
開發者ID:brharrington,項目名稱:spectator-examples,代碼行數:7,代碼來源:Config.java


注:本文中的com.netflix.servo.monitor.Pollers類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。