当前位置: 首页>>代码示例>>Java>>正文


Java Monitors类代码示例

本文整理汇总了Java中com.netflix.servo.monitor.Monitors的典型用法代码示例。如果您正苦于以下问题:Java Monitors类的具体用法?Java Monitors怎么用?Java Monitors使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Monitors类属于com.netflix.servo.monitor包,在下文中一共展示了Monitors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initServo

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
private static RepeatingActivity initServo(Exhibitor exhibitor, ActivityLog log, ActivityQueue activityQueue, ExhibitorArguments arguments, AtomicReference<CompositeMonitor<?>> theMonitor)
{
    theMonitor.set(null);

    RepeatingActivity localServoMonitoring = null;
    if ( arguments.servoRegistration != null )
    {
        ZookeeperMonitoredData  zookeeperMonitoredData = new ZookeeperMonitoredData();
        CompositeMonitor<?>     compositeMonitor = Monitors.newObjectMonitor(zookeeperMonitoredData);

        GetMonitorData          getMonitorData = new GetMonitorData(exhibitor, zookeeperMonitoredData);
        localServoMonitoring = new RepeatingActivityImpl(log, activityQueue, QueueGroups.IO, getMonitorData, arguments.servoRegistration.getZookeeperPollMs());
        arguments.servoRegistration.getMonitorRegistry().register(compositeMonitor);

        theMonitor.set(compositeMonitor);
    }
    return localServoMonitoring;
}
 
开发者ID:dcos,项目名称:exhibitor,代码行数:19,代码来源:Exhibitor.java

示例2: start

import com.netflix.servo.monitor.Monitors; //导入依赖的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: okHttpLoadBalancingClient

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(AbstractLoadBalancerAwareClient.class)
@ConditionalOnClass(name = "org.springframework.retry.support.RetryTemplate")
public RetryableOkHttpLoadBalancingClient okHttpLoadBalancingClient(
	IClientConfig config,
	ServerIntrospector serverIntrospector,
	ILoadBalancer loadBalancer,
	RetryHandler retryHandler,
	LoadBalancedRetryPolicyFactory loadBalancedRetryPolicyFactory,
	OkHttpClient delegate,
	LoadBalancedBackOffPolicyFactory loadBalancedBackOffPolicyFactory,
	LoadBalancedRetryListenerFactory loadBalancedRetryListenerFactory) {
	RetryableOkHttpLoadBalancingClient client = new RetryableOkHttpLoadBalancingClient(delegate, config,
			serverIntrospector, loadBalancedRetryPolicyFactory, loadBalancedBackOffPolicyFactory, loadBalancedRetryListenerFactory);
	client.setLoadBalancer(loadBalancer);
	client.setRetryHandler(retryHandler);
	Monitors.registerObject("Client_" + this.name, client);
	return client;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:20,代码来源:OkHttpRibbonConfiguration.java

示例4: retryableRibbonLoadBalancingHttpClient

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(AbstractLoadBalancerAwareClient.class)
@ConditionalOnClass(name = "org.springframework.retry.support.RetryTemplate")
public RetryableRibbonLoadBalancingHttpClient retryableRibbonLoadBalancingHttpClient(
	IClientConfig config, ServerIntrospector serverIntrospector,
	ILoadBalancer loadBalancer, RetryHandler retryHandler,
	LoadBalancedRetryPolicyFactory loadBalancedRetryPolicyFactory, CloseableHttpClient httpClient,
	LoadBalancedBackOffPolicyFactory loadBalancedBackOffPolicyFactory,
	LoadBalancedRetryListenerFactory loadBalancedRetryListenerFactory) {
	RetryableRibbonLoadBalancingHttpClient client = new RetryableRibbonLoadBalancingHttpClient(
		httpClient, config, serverIntrospector, loadBalancedRetryPolicyFactory,
		loadBalancedBackOffPolicyFactory, loadBalancedRetryListenerFactory);
	client.setLoadBalancer(loadBalancer);
	client.setRetryHandler(retryHandler);
	Monitors.registerObject("Client_" + this.name, client);
	return client;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:18,代码来源:HttpClientRibbonConfiguration.java

示例5: initWithNiwsConfig

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
@Override
public void initWithNiwsConfig(IClientConfig niwsClientConfig) {
    String sZoneAffinity = "" + niwsClientConfig.getProperty(CommonClientConfigKey.EnableZoneAffinity, false);
    if (sZoneAffinity != null){
        zoneAffinity = Boolean.parseBoolean(sZoneAffinity);
        logger.debug("ZoneAffinity is set to {}", zoneAffinity);
    }
    String sZoneExclusive = "" + niwsClientConfig.getProperty(CommonClientConfigKey.EnableZoneExclusivity, false);
    if (sZoneExclusive != null){
        zoneExclusive = Boolean.parseBoolean(sZoneExclusive);
    }
    if (ConfigurationManager.getDeploymentContext() != null) {
        zone = ConfigurationManager.getDeploymentContext().getValue(ContextKey.zone);
    }
    activeReqeustsPerServerThreshold = DynamicPropertyFactory.getInstance().getDoubleProperty(niwsClientConfig.getClientName() + "." + niwsClientConfig.getNameSpace() + ".zoneAffinity.maxLoadPerServer", 0.6d);
    logger.debug("activeReqeustsPerServerThreshold: {}", activeReqeustsPerServerThreshold.get());
    blackOutServerPercentageThreshold = DynamicPropertyFactory.getInstance().getDoubleProperty(niwsClientConfig.getClientName() + "." + niwsClientConfig.getNameSpace() + ".zoneAffinity.maxBlackOutServesrPercentage", 0.8d);
    logger.debug("blackOutServerPercentageThreshold: {}", blackOutServerPercentageThreshold.get());
    availableServersThreshold = DynamicPropertyFactory.getInstance().getIntProperty(niwsClientConfig.getClientName() + "." + niwsClientConfig.getNameSpace() + ".zoneAffinity.minAvailableServers", 2);
    logger.debug("availableServersThreshold: {}", availableServersThreshold.get());
    overrideCounter = Monitors.newCounter("ZoneAffinity_OverrideCounter");

    Monitors.registerObject("NIWSServerListFilter_" + niwsClientConfig.getClientName());
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:25,代码来源:ZoneAffinityServerListFilter.java

示例6: initWithNiwsConfig

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
/**
 * Set necessary parameters from client configuration and register with Servo monitors.
 */
@Override
public void initWithNiwsConfig(IClientConfig clientConfig) {
    if (clientConfig == null) {
        return;    
    }
    clientName = clientConfig.getClientName();
    if (clientName == null) {
        clientName = "default";
    }
    vipAddresses = clientConfig.resolveDeploymentContextbasedVipAddresses();
    maxAutoRetries = clientConfig.getPropertyAsInteger(CommonClientConfigKey.MaxAutoRetries, DefaultClientConfigImpl.DEFAULT_MAX_AUTO_RETRIES);
    maxAutoRetriesNextServer = clientConfig.getPropertyAsInteger(CommonClientConfigKey.MaxAutoRetriesNextServer,maxAutoRetriesNextServer);

    okToRetryOnAllOperations = clientConfig.getPropertyAsBoolean(CommonClientConfigKey.OkToRetryOnAllOperations, okToRetryOnAllOperations);
    defaultRetryHandler = new DefaultLoadBalancerRetryHandler(clientConfig);
    
    tracer = getExecuteTracer();

    Monitors.registerObject("Client_" + clientName, this);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:24,代码来源:LoadBalancerContext.java

示例7: setUp

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
private void setUp(String name, int maxRetries, 
        long maxTotalTimeToPrimeConnections, String primeConnectionsURI, float primeRatio) {        
    this.name = name;
    this.maxRetries = maxRetries;
    this.maxTotalTimeToPrimeConnections = maxTotalTimeToPrimeConnections;
    this.primeConnectionsURIPath = primeConnectionsURI;        
    this.primeRatio = primeRatio;
    executorService = new ThreadPoolExecutor(1 /* minimum */,
            maxExecutorThreads /* max threads */,
            executorThreadTimeout /*
                                   * timeout - same property as create
                                   * timeout
                                   */, TimeUnit.MILLISECONDS,
            new LinkedBlockingQueue<Runnable>()
            /* Bounded queue with FIFO- bounded to max tasks */,
            new ASyncPrimeConnectionsThreadFactory(name) /*
                                                          * So we can give
                                                          * our Thread a
                                                          * name
                                                          */
    );        
    totalCounter = Monitors.newCounter(name + "_PrimeConnection_TotalCounter");
    successCounter = Monitors.newCounter(name + "_PrimeConnection_SuccessCounter");
    initialPrimeTimer = Monitors.newTimer(name + "_initialPrimeConnectionsTimer", TimeUnit.MILLISECONDS);
    Monitors.registerObject(name + "_PrimeConnection", this);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:27,代码来源:PrimeConnections.java

示例8: ConnectionPool

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
/**
 *
 * @param config Client configuration
 * @param lb LoadBalancer implementation
 */
@Inject
public ConnectionPool(ClientConfig config, ILoadBalancer lb) {
    this.config = config;
    this.lb = lb;

    connectionSweeper = Executors.newScheduledThreadPool(1);
    newConnectionBuilder = Executors.newFixedThreadPool(1);

    Monitors.registerObject(this);

    populationLatch = new CountDownLatch(Math.min(lb.getServerList(true).size(), config.getAsyncSenderThreads()));
    Executors.newSingleThreadExecutor().submit(new Runnable() {
        @Override
        public void run() {
            populateClients();
        }
    });
    try {
        populationLatch.await(populationLatch.getCount() * config.getConnectionTimeout(), TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
        logger.error("Exception on CountDownLatch awaiting: " + e.getMessage(), e);
    }
    logger.info("ConnectionPool population finished with the size: " + getPoolSize()
            + ", will continue up to: " + lb.getServerList(true).size());
}
 
开发者ID:Netflix,项目名称:suro,代码行数:31,代码来源:ConnectionPool.java

示例9: RemoteFileSink

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
public RemoteFileSink(
        LocalFileSink localFileSink,
        RemotePrefixFormatter prefixFormatter,
        int concurrentUpload,
        boolean batchUpload) {
    this.localFileSink = localFileSink;
    this.prefixFormatter = prefixFormatter == null ? new DynamicRemotePrefixFormatter("date(yyyyMMdd)") : prefixFormatter;
    this.batchUpload = batchUpload;

    Preconditions.checkNotNull(localFileSink, "localFileSink is needed");

    uploader = Executors.newFixedThreadPool(concurrentUpload == 0 ? 5 : concurrentUpload);
    localFilePoller = Executors.newSingleThreadExecutor();

    if (!batchUpload) {
        localFileSink.cleanUp(false);
    }

    Monitors.registerObject(
            this.getClass().getSimpleName() + '-' + localFileSink.getOutputDir().replace('/', '_'),
            this);
}
 
开发者ID:Netflix,项目名称:suro,代码行数:23,代码来源:RemoteFileSink.java

示例10: setupMonitoring

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
private void setupMonitoring(boolean shutdown) {
    try {
        final ObjectName mBeanName = ObjectName.getInstance("com.netflix.evcache:Group=" + appName
                + ",SubGroup=pool,SubSubGroup=" + serverGroup.getName() + ",SubSubSubGroup=" + id);
        final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
        if (mbeanServer.isRegistered(mBeanName)) {
            if (log.isDebugEnabled()) log.debug("MBEAN with name " + mBeanName
                    + " has been registered. Will unregister the previous instance and register a new one.");
            mbeanServer.unregisterMBean(mBeanName);
        }
        if (!shutdown) {
            mbeanServer.registerMBean(this, mBeanName);
            Monitors.registerObject(this);
        } else {
            Monitors.unregisterObject(this);
        }
    } catch (Exception e) {
        if (log.isWarnEnabled()) log.warn(e.getMessage(), e);
    }
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:21,代码来源:EVCacheConnectionObserver.java

示例11: setupMonitoring

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
private void setupMonitoring() {
    try {
        final ObjectName mBeanName = ObjectName.getInstance("com.netflix.evcache:Group=" + _appName
                + ",SubGroup=pool");
        final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
        if (mbeanServer.isRegistered(mBeanName)) {
            if (log.isDebugEnabled()) log.debug("MBEAN with name " + mBeanName
                    + " has been registered. Will unregister the previous instance and register a new one.");
            mbeanServer.unregisterMBean(mBeanName);
        }
        if (!_shutdown) {
            mbeanServer.registerMBean(this, mBeanName);
            Monitors.registerObject(this);
        } else {
            Monitors.unregisterObject(this);
        }
    } catch (Exception e) {
        if (log.isDebugEnabled()) log.debug("Exception", e);
    }
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:21,代码来源:EVCacheClientPool.java

示例12: getDistributionSummary

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
public static DistributionSummary getDistributionSummary(String name, String appName, String serverGroup) {
    final String metricName = getMetricName(appName, serverGroup, name);
    final DistributionSummary _ds = distributionSummaryMap.get(metricName);
    if(_ds != null) return _ds;
    final Registry registry = Spectator.globalRegistry(); //_poolManager.getRegistry();
    if (registry != null) {
        Id id = registry.createId(name);
        id = id.withTag("owner", "evcache");
        id = id.withTag("APP", appName);
        if(serverGroup != null) id = id.withTag("ServerGroup", serverGroup);
        final DistributionSummary ds = registry.distributionSummary(id);
        if (!Monitors.isObjectRegistered(ds)) Monitors.registerObject(ds);
        distributionSummaryMap.put(metricName, ds);
        return ds;
    }
    return null;
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:18,代码来源:EVCacheMetricsFactory.java

示例13: DynoCPMonitor

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
public DynoCPMonitor(String namePrefix) {
	
	try {
		DefaultMonitorRegistry.getInstance().register(Monitors.newObjectMonitor(namePrefix, this));
	} catch (Exception e) {
		Logger.warn("Failed to register metrics with monitor registry", e);
	}
}
 
开发者ID:Netflix,项目名称:dyno,代码行数:9,代码来源:DynoCPMonitor.java

示例14: HealthMonitor

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
@Inject
public HealthMonitor(IConfiguration config, InstanceManager instanceManager, HttpModule httpModule) {
    super(config);
    this.instanceManager = instanceManager;
    this.httpModule = httpModule;
    healthReporter = new Elasticsearch_HealthReporter();
    discoveryClient = DiscoveryManager.getInstance().getDiscoveryClient();
    Monitors.registerObject(healthReporter);
}
 
开发者ID:Netflix,项目名称:Raigad,代码行数:10,代码来源:HealthMonitor.java

示例15: SnapshotBackupMonitor

import com.netflix.servo.monitor.Monitors; //导入依赖的package包/类
@Inject
public SnapshotBackupMonitor(IConfiguration config, SnapshotBackupManager snapshotBackupManager) {
    super(config);
    snapshotBackupReporter = new Elasticsearch_SnapshotBackupReporter();
    this.snapshotBackupManager = snapshotBackupManager;
    Monitors.registerObject(snapshotBackupReporter);
}
 
开发者ID:Netflix,项目名称:Raigad,代码行数:8,代码来源:SnapshotBackupMonitor.java


注:本文中的com.netflix.servo.monitor.Monitors类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。