@Override public void register(NamedCount monitorObj) { Monitors.registerObject(monitorObj); } }
public RetryableEurekaHttpClient(String name, EurekaTransportConfig transportConfig, ClusterResolver clusterResolver, TransportClientFactory clientFactory, ServerStatusEvaluator serverStatusEvaluator, int numberOfRetries) { this.name = name; this.transportConfig = transportConfig; this.clusterResolver = clusterResolver; this.clientFactory = clientFactory; this.serverStatusEvaluator = serverStatusEvaluator; this.numberOfRetries = numberOfRetries; Monitors.registerObject(name, this); }
/** * Register an object with the default registry. Equivalent to * {@code DefaultMonitorRegistry.getInstance().register(Monitors.newObjectMonitor(obj))}. */ public static void registerObject(Object obj) { registerObject(null, obj); }
public void init() { Monitors.registerObject(this); }
@Inject public EIPManager(EurekaServerConfig serverConfig, EurekaClientConfig clientConfig, PeerAwareInstanceRegistry registry, ApplicationInfoManager applicationInfoManager) { this.serverConfig = serverConfig; this.clientConfig = clientConfig; this.registry = registry; this.applicationInfoManager = applicationInfoManager; try { Monitors.registerObject(this); } catch (Throwable e) { logger.warn("Cannot register the JMX monitor for the InstanceRegistry", e); } }
@Inject public ElasticNetworkInterfaceBinder( EurekaServerConfig serverConfig, EurekaClientConfig clientConfig, PeerAwareInstanceRegistry registry, ApplicationInfoManager applicationInfoManager) { this.serverConfig = serverConfig; this.clientConfig = clientConfig; this.registry = registry; this.applicationInfoManager = applicationInfoManager; try { Monitors.registerObject(this); } catch (Throwable e) { logger.warn("Cannot register the JMX monitor for the InstanceRegistry", e); } }
@Override public void register(NamedCount monitorObj) { Monitors.registerObject(monitorObj); } }
public void registerMonitors() { try { Monitors.registerObject(this); } catch (Exception e) { if (log.isWarnEnabled()) log.warn("Exception while registering.", e); } }
public SessionedEurekaHttpClient(String name, EurekaHttpClientFactory clientFactory, long sessionDurationMs) { this.name = name; this.clientFactory = clientFactory; this.sessionDurationMs = sessionDurationMs; this.currentSessionDurationMs = randomizeSessionDuration(sessionDurationMs); Monitors.registerObject(name, this); }
public CustomCompositeExample(String id) { Monitors.registerObject(id, this); }
/** * Register all statistics with <tt>Servo</tt>. */ public static void registerAllStats() { for (EurekaMonitors c : EurekaMonitors.values()) { Monitors.registerObject(c.getName(), c); } }
public ReloadingClusterResolver(final ClusterResolverFactory<T> factory, final long reloadIntervalMs) { this.factory = factory; this.reloadIntervalMs = reloadIntervalMs; this.maxReloadIntervalMs = MAX_RELOAD_INTERVAL_MULTIPLIER * reloadIntervalMs; this.delegateRef = new AtomicReference<>(factory.createClusterResolver()); this.lastUpdateTime = System.currentTimeMillis(); this.currentReloadIntervalMs = reloadIntervalMs; List<T> clusterEndpoints = delegateRef.get().getClusterEndpoints(); if (clusterEndpoints.isEmpty()) { logger.error("Empty Eureka server endpoint list during initialization process"); throw new ClusterResolverException("Resolved to an empty endpoint list"); } if (logger.isInfoEnabled()) { logger.info("Initiated with delegate resolver of type {}; next reload in {}[sec]. Loaded endpoints={}", delegateRef.get().getClass(), currentReloadIntervalMs / 1000, clusterEndpoints); } try { Monitors.registerObject(this); } catch (Throwable e) { logger.warn("Cannot register metrics", e); } }
@Override public void init(PeerEurekaNodes peerEurekaNodes) throws Exception { this.numberOfReplicationsLastMin.start(); this.peerEurekaNodes = peerEurekaNodes; initializedResponseCache(); scheduleRenewalThresholdUpdateTask(); initRemoteRegionRegistry(); try { Monitors.registerObject(this); } catch (Throwable e) { logger.warn("Cannot register the JMX monitor for the InstanceRegistry :", e); } }
private ConnectionCleanerTask(int connectionIdleTimeout) { this.connectionIdleTimeout = connectionIdleTimeout; MonitorConfig.Builder monitorConfigBuilder = MonitorConfig.builder("Eureka-Connection-Cleaner-Time"); executionTimeStats = new BasicTimer(monitorConfigBuilder.build()); cleanupFailed = new BasicCounter(MonitorConfig.builder("Eureka-Connection-Cleaner-Failure").build()); try { Monitors.registerObject(this); } catch (Exception e) { s_logger.error("Unable to register with servo.", e); } }
public ApacheHttpClientConnectionCleaner(ApacheHttpClient4 apacheHttpClient, final long connectionIdleTimeout) { this.apacheHttpClient = apacheHttpClient; this.eurekaConnCleaner.scheduleWithFixedDelay( new Runnable() { @Override public void run() { cleanIdle(connectionIdleTimeout); } }, HTTP_CONNECTION_CLEANER_INTERVAL_MS, HTTP_CONNECTION_CLEANER_INTERVAL_MS, TimeUnit.MILLISECONDS ); MonitorConfig.Builder monitorConfigBuilder = MonitorConfig.builder("Eureka-Connection-Cleaner-Time"); executionTimeStats = new BasicTimer(monitorConfigBuilder.build()); cleanupFailed = new BasicCounter(MonitorConfig.builder("Eureka-Connection-Cleaner-Failure").build()); try { Monitors.registerObject(this); } catch (Exception e) { logger.error("Unable to register with servo.", e); } }
public TimedSupervisorTask(String name, ScheduledExecutorService scheduler, ThreadPoolExecutor executor, int timeout, TimeUnit timeUnit, int expBackOffBound, Runnable task) { this.scheduler = scheduler; this.executor = executor; this.timeoutMillis = timeUnit.toMillis(timeout); this.task = task; this.delay = new AtomicLong(timeoutMillis); this.maxDelay = timeoutMillis * expBackOffBound; // Initialize the counters and register. successCounter = Monitors.newCounter("success"); timeoutCounter = Monitors.newCounter("timeouts"); rejectedCounter = Monitors.newCounter("rejectedExecutions"); throwableCounter = Monitors.newCounter("throwables"); threadPoolLevelGauge = new LongGauge(MonitorConfig.builder("threadPoolUsed").build()); Monitors.registerObject(name, this); }
void initMonitors(String name) { Preconditions.checkNotNull(name); freeEntryCounter = Monitors.newCounter(name + "_Reuse"); createEntryCounter = Monitors.newCounter(name + "_CreateNew"); requestCounter = Monitors.newCounter(name + "_Request"); releaseCounter = Monitors.newCounter(name + "_Release"); deleteCounter = Monitors.newCounter(name + "_Delete"); requestTimer = Monitors.newTimer(name + "_RequestConnectionTimer", TimeUnit.MILLISECONDS); creationTimer = Monitors.newTimer(name + "_CreateConnectionTimer", TimeUnit.MILLISECONDS); this.name = name; Monitors.registerObject(name, this); }
AcceptorExecutor(String id, int maxBufferSize, int maxBatchingSize, long maxBatchingDelay, long congestionRetryDelayMs, long networkFailureRetryMs) { this.maxBufferSize = maxBufferSize; this.maxBatchingSize = maxBatchingSize; this.maxBatchingDelay = maxBatchingDelay; this.trafficShaper = new TrafficShaper(congestionRetryDelayMs, networkFailureRetryMs); ThreadGroup threadGroup = new ThreadGroup("eurekaTaskExecutors"); this.acceptorThread = new Thread(threadGroup, new AcceptorRunner(), "TaskAcceptor-" + id); this.acceptorThread.setDaemon(true); this.acceptorThread.start(); final double[] percentiles = {50.0, 95.0, 99.0, 99.5}; final StatsConfig statsConfig = new StatsConfig.Builder() .withSampleSize(1000) .withPercentiles(percentiles) .withPublishStdDev(true) .build(); final MonitorConfig config = MonitorConfig.builder(METRIC_REPLICATION_PREFIX + "batchSize").build(); this.batchSizeMetric = new StatsTimer(config, statsConfig); try { Monitors.registerObject(id, this); } catch (Throwable e) { logger.warn("Cannot register servo monitor for this object", e); } }
@Test public void testIsRegistered() throws Exception { ClassWithMonitors obj = new ClassWithMonitors(); assertFalse(Monitors.isObjectRegistered("id", obj)); Monitors.registerObject("id", obj); assertTrue(Monitors.isObjectRegistered("id", obj)); }
TaskExecutorMetrics(String id) { final double[] percentiles = {50.0, 95.0, 99.0, 99.5}; final StatsConfig statsConfig = new StatsConfig.Builder() .withSampleSize(1000) .withPercentiles(percentiles) .withPublishStdDev(true) .build(); final MonitorConfig config = MonitorConfig.builder(METRIC_REPLICATION_PREFIX + "executionTime").build(); taskWaitingTimeForProcessing = new StatsTimer(config, statsConfig); try { Monitors.registerObject(id, this); } catch (Throwable e) { logger.warn("Cannot register servo monitor for this object", e); } }