@Override protected BasicPoolEntry getFreeEntry(RouteSpecificPool rospl, Object state) { BasicPoolEntry entry = super.getFreeEntry(rospl, state); if (entry != null) { freeEntryCounter.increment(); } return entry; }
@Override public void freeEntry(BasicPoolEntry entry, boolean reusable, long validDuration, TimeUnit timeUnit) { releaseCounter.increment(); super.freeEntry(entry, reusable, validDuration, timeUnit); }
@Override public PoolEntryRequest requestPoolEntry(HttpRoute route, Object state) { requestCounter.increment(); return super.requestPoolEntry(route, state); }
@Override protected void deleteEntry(BasicPoolEntry entry) { deleteCounter.increment(); super.deleteEntry(entry); }
/** * {@inheritDoc} */ @Override public void increment() { getMonitorForCurrentContext().increment(); }
/** * Increment a counter based on a given {@link MonitorConfig}. */ public static void increment(MonitorConfig config) { INSTANCE.get(config).increment(); }
public static void increment(String appName, String cacheName, String metricName) { final Counter counter = getCounter(appName, cacheName, null, metricName, DataSourceType.COUNTER); counter.increment(); }
/** * Increment a counter based on a given {@link MonitorConfig} by a given delta. * * @param config The monitoring config * @param delta The amount added to the current value */ public static void increment(MonitorConfig config, long delta) { INSTANCE.get(config).increment(delta); }
/** * {@inheritDoc} */ @Override public void increment(long amount) { getMonitorForCurrentContext().increment(amount); }
public static void increment(String name) { final Counter counter = getCounter(name); counter.increment(); }
public static void increment(String appName, String cacheName, String serverGroupName, String metricName) { final Counter counter = getCounter(appName, cacheName, serverGroupName, metricName, DataSourceType.COUNTER); counter.increment(); }
protected boolean removeEldestEntry(Map.Entry<MonitorConfig, NormalizedValue> eldest) { final long lastMod = eldest.getValue().lastUpdateTime; if (lastMod < 0) { return false; } final long now = clock.now(); final boolean expired = (now - lastMod) > heartbeatMillis; if (expired) { HEARTBEAT_EXCEEDED.increment(); LOGGER.debug("heartbeat interval exceeded, expiring {}", eldest.getKey()); } return expired; } };
public void count(Throwable ex) { getOrCreateCounter(extractName(ex)).increment(); }
@Override protected <R> EurekaHttpResponse<R> execute(RequestExecutor<R> requestExecutor) { EurekaHttpClientRequestMetrics requestMetrics = metricsByRequestType.get(requestExecutor.getRequestType()); Stopwatch stopwatch = requestMetrics.latencyTimer.start(); try { EurekaHttpResponse<R> httpResponse = requestExecutor.execute(delegate); requestMetrics.countersByStatus.get(mappedStatus(httpResponse)).increment(); return httpResponse; } catch (Exception e) { requestMetrics.connectionErrors.increment(); exceptionsMetric.count(e); throw e; } finally { stopwatch.stop(); } }
@Override protected BasicPoolEntry createEntry(RouteSpecificPool rospl, ClientConnectionOperator op) { createEntryCounter.increment(); Stopwatch stopWatch = creationTimer.start(); try { return super.createEntry(rospl, op); } finally { stopWatch.stop(); } }
public void cleanIdle(long delayMs) { Stopwatch start = executionTimeStats.start(); try { apacheHttpClient.getClientHandler().getHttpClient() .getConnectionManager() .closeIdleConnections(delayMs, TimeUnit.SECONDS); } catch (Throwable e) { logger.error("Cannot clean connections", e); cleanupFailed.increment(); } finally { if (null != start) { start.stop(); } } } }
@Override public void receivedStatus(OperationStatus s) { rv.set(new Long(s.isSuccess() ? s.getMessage() : "-1")); final MemcachedNode node = getEVCacheNode(key); if(node instanceof EVCacheNodeImpl) { getCounter("MutateOperation-"+ s.getStatusCode().name(), ((EVCacheNodeImpl)node).getBaseTags()).increment(); } else { getCounter("MutateOperation-"+ s.getStatusCode().name(), BasicTagList.of("HOST", node.getSocketAddress().toString())).increment(); } }
@Override public void receivedStatus(OperationStatus val) { if (val.getStatusCode().equals(StatusCode.SUCCESS)) { if (log.isDebugEnabled()) log.debug("AddOrAppend Key (Append Operation): " + key + "; Status : " + val.getStatusCode().name() + "; Message : " + val.getMessage() + "; Elapsed Time - " + (operationDuration.getDuration(TimeUnit.MILLISECONDS))); getCounter(AOA_APPEND_OPERATION_SUCCESS_STRING).increment(); rv.set(Boolean.TRUE, val); appendSuccess = true; } else { getCounter("AoA-AppendOperation-"+ val.getStatusCode().name()).increment(); } }
@Override public void run() { Stopwatch start = executionTimeStats.start(); try { HttpClientConnectionManager cm = (HttpClientConnectionManager) apacheHttpClient .getConfiguration() .getProperty(ApacheClientProperties.CONNECTION_MANAGER); cm.closeIdleConnections(connectionIdleTimeout, TimeUnit.SECONDS); } catch (Throwable e) { s_logger.error("Cannot clean connections", e); cleanupFailed.increment(); } finally { if (null != start) { start.stop(); } } } }
@Override @SuppressWarnings("synthetic-access") public void receivedStatus(OperationStatus status) { operationDuration.stop(); if (log.isDebugEnabled()) log.debug("GetBulk Keys : " + keys + "; Status : " + status.getStatusCode().name() + "; Message : " + status.getMessage() + "; Elapsed Time - " + operationDuration.getDuration(TimeUnit.MILLISECONDS)); if (status.getStatusCode().equals(StatusCode.SUCCESS)) { getCounter(BULK_OPERATION_STRING + "-SUCCESS").increment(); } else { getCounter(BULK_OPERATION_STRING + "-" + status.getStatusCode().name()).increment();//First lets get some data and then we can add Host info } rv.setStatus(status); }