public void update(long delayMs) { long delaySec = delayMs / 1000; long matchedIdx; if (levels[0] > delaySec) { matchedIdx = -1; } else { matchedIdx = levels.length - 1; for (int i = 0; i < levels.length - 1; i++) { if (levels[i] <= delaySec && delaySec < levels[i + 1]) { matchedIdx = i; break; } } } for (int i = 0; i < levels.length; i++) { if (i == matchedIdx) { gauges[i].set(1L); } else { gauges[i].set(0L); } } }
@Override public void run() { try { Current current = measure(); if (current != null) { LOG.debug("reservedMemory={}, maxMemory={}", current.reservedMemory, current.maxMemory); reservedMemoryGauge.set(current.reservedMemory); maxMemoryGauge.set(current.maxMemory); } } catch (Throwable t) { LOG.warn("Error in DirectMemoryMonitor task.", t); } }
@Override public void update(StatsBuffer buffer) { gauge.set(buffer.getMin()); } }
@Override public void update(StatsBuffer buffer) { gauge.set(buffer.getMax()); } }
@Override public void run() { try { Current current = measure(); if (current != null) { LOG.debug("reservedMemory={}, maxMemory={}", current.reservedMemory, current.maxMemory); reservedMemoryGauge.set(current.reservedMemory); maxMemoryGauge.set(current.maxMemory); } } catch (Throwable t) { LOG.warn("Error in DirectMemoryMonitor task.", t); } }
public void run() { // init the version information if(versionGauge == null) { final String fullVersion; final String jarName; if(this.getClass().getPackage().getImplementationVersion() != null) { fullVersion = this.getClass().getPackage().getImplementationVersion(); } else { fullVersion = "unknown"; } if(this.getClass().getPackage().getImplementationVersion() != null) { jarName = this.getClass().getPackage().getImplementationTitle(); } else { jarName = "unknown"; } if(log.isErrorEnabled()) log.error("fullVersion : " + fullVersion + "; jarName : " + jarName); versionGauge = EVCacheMetricsFactory.getLongGauge("evcache-client", BasicTagList.of("version", fullVersion, "jarName", jarName)); } versionGauge.set(Long.valueOf(1)); poolManager.getEVCacheScheduledExecutor().schedule(this, 30, TimeUnit.SECONDS); }
@Test public void testSet() throws Exception { LongGauge gauge = newInstance("test"); gauge.set(10L); assertEquals(gauge.getValue().longValue(), 10L); }
@Test public void testGetValue() throws Exception { LongGauge gauge = newInstance("test"); assertEquals(gauge.getValue().longValue(), 0L); gauge.set(10L); assertEquals(gauge.getValue().longValue(), 10L); }
MonitorConfig monitorConfig = EVCacheConfig.getInstance().getMonitorConfig(metricPrefix + "_ContinuousTimeout", DataSourceType.GAUGE, baseTags); final LongGauge cTimeouts = new LongGauge(monitorConfig); cTimeouts.set(Long.valueOf(getContinuousTimeout())); metrics.add(cTimeouts); DataSourceType.GAUGE, baseTags); final LongGauge wQueue = new LongGauge(monitorConfig); wQueue.set(Long.valueOf(writeQ.size())); metrics.add(wQueue); baseTags); final LongGauge rQueue = new LongGauge(monitorConfig); rQueue.set(Long.valueOf(readQ.size())); metrics.add(rQueue);
final TagList tags = client.getTagList(); if (i == 0) { EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-PoolSize", tags).set(Long.valueOf(size)); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-ActiveConnections", tags).set(Long.valueOf(activeServerCount * size)); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-InactiveConnections", tags).set(Long.valueOf(inActiveServerCount * size)); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-InDiscovery", tags).set(Long.valueOf(sizeInDiscovery)); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-InHashing", tags).set(Long.valueOf(sizeInHashing)); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-ReadInstanceCount", tags).set(Long.valueOf(readClients.get(0).getConnectionObserver().getActiveServerCount())); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-WriteInstanceCount", tags).set(Long.valueOf(writeClients.get(0).getConnectionObserver().getActiveServerCount())); reconcile = true; lastReconcileTime = currentTime; EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-Reconcile", tags).set(Long.valueOf(1)); } else { EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-Reconcile", tags).set(Long.valueOf(0)); if (log.isDebugEnabled()) log.debug("AppName :" + _appName + "; ServerGroup : " + serverGroup + "; instance : " + instance + " not found and will shutdown the client and init it again."); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-haveInstancesInServerGroupChanged", tags).set(Long.valueOf(1)); return true; if (log.isDebugEnabled()) log.debug("AppName :" + _appName + "; ServerGroup : " + serverGroup + "; instance : " + entry.getKey() + " not found in discovery and will shutdown the client and init it again."); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-haveInstancesInServerGroupChanged", tags).set(Long.valueOf(2)); return true; EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-haveInstancesInServerGroupChanged",tags).set(Long.valueOf(3));
private void updateQueueStats() { for (ServerGroup serverGroup : memcachedInstancesByServerGroup.keySet()) { List<EVCacheClient> clients = memcachedInstancesByServerGroup.get(serverGroup); for(EVCacheClient client : clients) { final int wSize = client.getWriteQueueLength(); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-WriteQueueSize", client.getTagList()).set(Long.valueOf(wSize)); final int rSize = client.getReadQueueLength(); EVCacheMetricsFactory.getLongGauge("EVCacheClientPool-ReadQueueSize", client.getTagList()).set(Long.valueOf(rSize)); if(refreshConnectionOnReadQueueFull.get()) { final Collection<MemcachedNode> allNodes = client.getNodeLocator().getAll(); for (MemcachedNode node : allNodes) { if (node instanceof EVCacheNodeImpl) { final EVCacheNodeImpl evcNode = ((EVCacheNodeImpl) node); if(evcNode.getReadQueueSize() >= refreshConnectionOnReadQueueFullSize.get().intValue()) { EVCacheMetricsFactory.getCounter("EVCacheClientPool-REFRESH_ON_QUEUE_FULL", evcNode.getBaseTags()).increment(); client.getEVCacheMemcachedClient().reconnectNode(evcNode); } } } } } } }
config = new EVCacheServerGroupConfig(serverGroup, instances, rendPort, udsproxyMemcachedPort, udsproxyMementoPort); instancesSpecific.put(serverGroup, config); EVCacheMetricsFactory.getLongGauge(_appName + "-port", BasicTagList.of("ServerGroup", asgName, "APP", _appName)).set(Long.valueOf(port));
basicCounter.increment(i); stepCounter.increment(i); gauge.set((long) i); List<Metric> metrics = getValue(monitors, manualClock); toRateMetricTransform.update(metrics);
public void setUnregisterCount(long n) { unregisterCount.set(n); } }
public void setRegisterCount(long n) { registerCount.set(n); }
public void setTotalCount(long n) { totalCount.set(n); }
public void setUpdateCount(long n) { updateCount.set(n); }
@Override public void update(StatsBuffer buffer) { gauge.set(buffer.getMax()); } }
@Override public void update(StatsBuffer buffer) { gauge.set(buffer.getMin()); } }