protected LongGaugeWrapper(MonitorConfig config) { gauge = new LongGauge(config); }
public ThresholdLevelsMetric(Object owner, String prefix, long[] levels) { this.levels = levels; this.gauges = new LongGauge[levels.length]; for (int i = 0; i < levels.length; i++) { String name = prefix + String.format("%05d", levels[i]); MonitorConfig config = new MonitorConfig.Builder(name) .withTag("class", owner.getClass().getName()) .build(); gauges[i] = new LongGauge(config); try { DefaultMonitorRegistry.getInstance().register(gauges[i]); } catch (Throwable e) { logger.warn("Cannot register metric {}", name, e); } } }
public static LongGauge getLongGauge(String cName, TagList tag) { final String name = new StringBuilder(128).append(cName).append(tag.toString()).toString(); LongGauge gauge = (LongGauge) monitorMap.get(name); if (gauge == null) { writeLock.lock(); try { if (monitorMap.containsKey(name)) { gauge = (LongGauge) monitorMap.get(name); } else { gauge = new LongGauge(MonitorConfig.builder(cName).withTags(tag).withTag(OWNER).build()); monitorMap.put(name, gauge); DefaultMonitorRegistry.getInstance().register(gauge); } } finally { writeLock.unlock(); } } return gauge; }
public static LongGauge getLongGauge(String name) { LongGauge gauge = (LongGauge) monitorMap.get(name); if (gauge == null) { writeLock.lock(); try { if (monitorMap.containsKey(name)) { gauge = (LongGauge) monitorMap.get(name); } else { gauge = new LongGauge(MonitorConfig.builder(name).withTag(OWNER).build()); monitorMap.put(name, gauge); DefaultMonitorRegistry.getInstance().register(gauge); } } finally { writeLock.unlock(); } } return gauge; }
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); }
if(getContinuousTimeout() > 0) { MonitorConfig monitorConfig = EVCacheConfig.getInstance().getMonitorConfig(metricPrefix + "_ContinuousTimeout", DataSourceType.GAUGE, baseTags); final LongGauge cTimeouts = new LongGauge(monitorConfig); cTimeouts.set(Long.valueOf(getContinuousTimeout())); metrics.add(cTimeouts); MonitorConfig monitorConfig = EVCacheConfig.getInstance().getMonitorConfig(metricPrefix + "_WriteQ", DataSourceType.GAUGE, baseTags); final LongGauge wQueue = new LongGauge(monitorConfig); wQueue.set(Long.valueOf(writeQ.size())); metrics.add(wQueue); final LongGauge rQueue = new LongGauge(monitorConfig); rQueue.set(Long.valueOf(readQ.size())); metrics.add(rQueue);
@Override public LongGauge newInstance(String name) { return new LongGauge(MonitorConfig.builder(name).build()); }
StepCounter stepCounter = new StepCounter(MonitorConfig.builder("stepCounter").build(), manualClock); LongGauge gauge = new LongGauge(MonitorConfig.builder("longGauge").build());
protected LongGaugeWrapper(MonitorConfig config) { gauge = new LongGauge(config); }
private LongGauge getSubscriptionCounter(InterestKey interestKey) { LongGauge counter = subscribedClientsByInterest.get(interestKey); if (counter == null) { synchronized (subscribedClientsByInterest) { counter = subscribedClientsByInterest.get(interestKey); if (counter == null) { counter = new LongGauge(monitorConfig("subscriptions." + interestKey.getCounterName())); subscribedClientsByInterest.put(interestKey, counter); register(counter); } } } return counter; }
public static LongGauge newLongGauge(String name) { return new LongGauge(MonitorConfig.builder(name).build()); }
public static LongGauge newLongGauge(String name) { return new LongGauge(MonitorConfig.builder(name).build()); }
public ThresholdLevelsMetric(Object owner, String prefix, long[] levels) { this.levels = levels; this.gauges = new LongGauge[levels.length]; for (int i = 0; i < levels.length; i++) { String name = prefix + String.format("%05d", levels[i]); MonitorConfig config = new MonitorConfig.Builder(name) .withTag("class", owner.getClass().getName()) .build(); gauges[i] = new LongGauge(config); try { DefaultMonitorRegistry.getInstance().register(gauges[i]); } catch (Throwable e) { logger.warn("Cannot register metric {}", name, e); } } }
public HulkTimedTask(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. timeoutCounter = Monitors.newCounter("timeouts"); rejectedCounter = Monitors.newCounter("rejectedExecutions"); throwableCounter = Monitors.newCounter("throwables"); threadPoolLevelGauge = new LongGauge(MonitorConfig.builder("threadPoolUsed").build()); Monitors.registerObject(name, this); }
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); }