本文整理汇总了Java中com.netflix.servo.publish.MonitorRegistryMetricPoller类的典型用法代码示例。如果您正苦于以下问题:Java MonitorRegistryMetricPoller类的具体用法?Java MonitorRegistryMetricPoller怎么用?Java MonitorRegistryMetricPoller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MonitorRegistryMetricPoller类属于com.netflix.servo.publish包,在下文中一共展示了MonitorRegistryMetricPoller类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initMetricsPublishing
import com.netflix.servo.publish.MonitorRegistryMetricPoller; //导入依赖的package包/类
private static void initMetricsPublishing() throws Exception {
final List<MetricObserver> observers = new ArrayList<>();
if (Config.isFileObserverEnabled()) {
final File dir = Config.getFileObserverDirectory();
LOGGER.info("file observer enabled, logging to: " + dir);
observers.add(createFileObserver(dir));
}
if (Config.isAtlasObserverEnabled()) {
final String uri = Config.getAtlasObserverUri();
LOGGER.info("atlas observer enabled, uri: " + uri);
observers.add(createAtlasObserver());
}
PollScheduler.getInstance().start();
schedule(new MonitorRegistryMetricPoller(), observers);
}
开发者ID:brharrington,项目名称:spectator-examples,代码行数:19,代码来源:Main.java
示例2: start
import com.netflix.servo.publish.MonitorRegistryMetricPoller; //导入依赖的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
示例3: init
import com.netflix.servo.publish.MonitorRegistryMetricPoller; //导入依赖的package包/类
public void init() {
PollScheduler scheduler = PollScheduler.getInstance();
if (!scheduler.isStarted()) {
scheduler.start();
}
if (isRollingFileEnabled()) {
MetricObserver fileObserver = new FileOutputMetricObserver(fileOutput, convertor, formatter);
MetricObserver fileTransform = new CounterToRateMetricTransform(fileObserver, metricPoll, TimeUnit.SECONDS);
PollRunnable fileTask = new PollRunnable(new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL,
fileTransform);
scheduler.addPoller(fileTask, metricPoll, TimeUnit.SECONDS);
}
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:MetricsObserverInitializer.java
示例4: initialize
import com.netflix.servo.publish.MonitorRegistryMetricPoller; //导入依赖的package包/类
public static final void initialize() {
// register hystrix servo metrics publisher
HystrixPlugins.getInstance().registerMetricsPublisher(HystrixServoMetricsPublisher.getInstance());
// try to get name from openshift. assume it's scaleable app.
// format: <app name>. <namespace>.<gear dns>
String prefix = System.getenv("HOSTNAME"); // default
if (System.getenv("OPENSHIFT_APP_NAME") != null) {
prefix = String.format(
"%s.%s.%s",
System.getenv("OPENSHIFT_APP_NAME"),
System.getenv("OPENSHIFT_NAMESPACE"),
System.getenv("OPENSHIFT_GEAR_DNS")
);
}
String host = System.getenv("GRAPHITE_HOSTNAME");
String port = System.getenv("GRAPHITE_PORT");
String addr = host + ":" + port;
LOGGER.info("ServoConfig: prefix={}, address={}", prefix, addr);
MetricObserver observer = new GraphiteMetricObserver(prefix, addr);
// start poll scheduler
PollScheduler.getInstance().start();
// create registry on observer
PollRunnable registeryTask = new PollRunnable(new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, observer);
PollScheduler.getInstance().addPoller(registeryTask, 5, TimeUnit.SECONDS);
// create jvm poller
PollRunnable jvmTask = new PollRunnable(new JvmMetricPoller(), BasicMetricFilter.MATCH_ALL, observer);
PollScheduler.getInstance().addPoller(jvmTask, 5, TimeUnit.SECONDS);
}
开发者ID:jewzaam,项目名称:hystrixexample,代码行数:36,代码来源:ServoSetup.java
示例5: metricPoller
import com.netflix.servo.publish.MonitorRegistryMetricPoller; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(MetricPoller.class)
MetricPoller metricPoller() {
return new MonitorRegistryMetricPoller();
}
开发者ID:netflix-spring-one,项目名称:spring-cloud-netflix-contrib,代码行数:6,代码来源:SpectatorAutoConfiguration.java
示例6: doInitialize
import com.netflix.servo.publish.MonitorRegistryMetricPoller; //导入依赖的package包/类
private static synchronized void doInitialize(final Type... types) {
if (initialized) {
return;
}
// Fix Java 7 problem that initialized Hystrix/Servo before the it has been even called
Hystrix.reset();
HystrixPlugins.reset();
// register hystrix servo metrics publisher, required for collecting hystrix metrics
HystrixPlugins.getInstance().registerMetricsPublisher(HystrixServoMetricsPublisher.getInstance());
// if IllegalStateException is thrown it means there is a hytrix command being used prior to this setup.
// SEE: https://github.com/lightblue-platform/lightblue-rest/issues/58
// https://github.com/Netflix/Hystrix/issues/150
List<MetricObserver> observers = new ArrayList<>();
for (Type type : types) {
switch (type) {
case GRAPHITE:
registerGraphiteMetricObserver(observers, findVariable(ENV_GRAPHITE_PREFIX),
findVariable(ENV_GRAPHITE_HOSTNAME), findVariable(ENV_GRAPHITE_PORT));
break;
case STATSD:
registerStatsdMetricObserver(observers, findVariable(ENV_STATSD_PREFIX),
findVariable(ENV_STATSD_HOSTNAME), findVariable(ENV_STATSD_PORT));
break;
default:
throw new RuntimeException("Unsupported Type: " + type);
}
}
// start poll scheduler
PollScheduler.getInstance().start();
// create and register registery poller
PollRunnable registeryTask = new PollRunnable(new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, observers);
PollScheduler.getInstance().addPoller(registeryTask, 5, TimeUnit.SECONDS);
// create and register jvm poller
PollRunnable jvmTask = new PollRunnable(new JvmMetricPoller(), BasicMetricFilter.MATCH_ALL, observers);
PollScheduler.getInstance().addPoller(jvmTask, 5, TimeUnit.SECONDS);
initialized = true;
LOGGER.debug("doInitialize() completed, initialized = " + initialized);
}
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:47,代码来源:ServoGraphiteSetup.java
注:本文中的com.netflix.servo.publish.MonitorRegistryMetricPoller类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论