/** * * Return an existing histogram if * (a) A histogram already exist with the same metric name. * Otherwise, creates a new meter and registers * * @param registry MetricsRegistry * @param name metric name * @param biased (true if uniform distribution, otherwise exponential weighted) * @return histogram */ public static Histogram newHistogram(MetricsRegistry registry, MetricName name, boolean biased) { if (registry != null) { return registry.newHistogram(name, biased); } else { return Metrics.newHistogram(name, biased); } }
/** * Creates a new non-biased {@link com.yammer.metrics.core.Histogram} and registers it under the * given class and name. * * @param klass the class which owns the metric * @param name the name of the metric * @return a new {@link com.yammer.metrics.core.Histogram} */ public static Histogram newHistogram(Class<?> klass, String name) { return DEFAULT_REGISTRY.newHistogram(klass, name); }
/** * Creates a new {@link com.yammer.metrics.core.Histogram} and registers it under the given * metric name. * * @param metricName the name of the metric * @param biased whether or not the histogram should be biased * @return a new {@link com.yammer.metrics.core.Histogram} */ public static Histogram newHistogram(MetricName metricName, boolean biased) { return DEFAULT_REGISTRY.newHistogram(metricName, biased); }
/** * Creates a new {@link com.yammer.metrics.core.Histogram} and registers it under the given * class and name. * * @param klass the class which owns the metric * @param name the name of the metric * @param biased whether or not the histogram should be biased * @return a new {@link com.yammer.metrics.core.Histogram} */ public static Histogram newHistogram(Class<?> klass, String name, boolean biased) { return DEFAULT_REGISTRY.newHistogram(klass, name, biased); }
/** * Creates a new non-biased {@link Histogram} and registers it under the given class and name. * * @param klass the class which owns the metric * @param name the name of the metric * @return a new {@link Histogram} */ public Histogram newHistogram(Class<?> klass, String name) { return newHistogram(klass, name, false); }
/** * Creates a new non-biased {@link com.yammer.metrics.core.Histogram} and registers it under the * given class, name, and scope. * * @param klass the class which owns the metric * @param name the name of the metric * @param scope the scope of the metric * @return a new {@link com.yammer.metrics.core.Histogram} */ public static Histogram newHistogram(Class<?> klass, String name, String scope) { return DEFAULT_REGISTRY.newHistogram(klass, name, scope); }
/** * Creates a new {@link Histogram} and registers it under the given class and name. * * @param klass the class which owns the metric * @param name the name of the metric * @param biased whether or not the histogram should be biased * @return a new {@link Histogram} */ public Histogram newHistogram(Class<?> klass, String name, boolean biased) { return newHistogram(klass, name, null, biased); }
public RegionStats(MetricsRegistry registry, String name) { this.name = name; this.memstoreLoadHist = registry.newHistogram(MetricsConnection.class, MEMLOAD_BASE + this.name); this.heapOccupancyHist = registry.newHistogram(MetricsConnection.class, HEAP_BASE + this.name); }
@Override public Histogram newMetric(Class<?> clazz, String name, String scope) { return registry.newHistogram(clazz, name, scope); } };
/** * Creates a new non-biased {@link Histogram} and registers it under the given class, name, and * scope. * * @param klass the class which owns the metric * @param name the name of the metric * @param scope the scope of the metric * @return a new {@link Histogram} */ public Histogram newHistogram(Class<?> klass, String name, String scope) { return newHistogram(klass, name, scope, false); }
/** * Creates a new {@link com.yammer.metrics.core.Histogram} and registers it under the given * class, name, and scope. * * @param klass the class which owns the metric * @param name the name of the metric * @param scope the scope of the metric * @param biased whether or not the histogram should be biased * @return a new {@link com.yammer.metrics.core.Histogram} */ public static Histogram newHistogram(Class<?> klass, String name, String scope, boolean biased) { return DEFAULT_REGISTRY.newHistogram(klass, name, scope, biased); }
private CallTracker(MetricsRegistry registry, String name, String subName, String scope) { StringBuilder sb = new StringBuilder(CLIENT_SVC).append("_").append(name); if (subName != null) { sb.append("(").append(subName).append(")"); } this.name = sb.toString(); this.callTimer = registry.newTimer(MetricsConnection.class, DRTN_BASE + this.name, scope); this.reqHist = registry.newHistogram(MetricsConnection.class, REQ_BASE + this.name, scope); this.respHist = registry.newHistogram(MetricsConnection.class, RESP_BASE + this.name, scope); }
/** * Creates a new {@link Histogram} and registers it under the given group * and name. * * @param name the name of the metric * @param biased whether or not the histogram should be biased * @return a new {@link Histogram} */ private Histogram getHistogram(String name, boolean biased) { return registry.newHistogram(makeMetricName(name), biased); }
/** * Creates a new {@link Histogram} and registers it under the given class, name, and scope. * * @param klass the class which owns the metric * @param name the name of the metric * @param scope the scope of the metric * @param biased whether or not the histogram should be biased * @return a new {@link Histogram} */ public Histogram newHistogram(Class<?> klass, String name, String scope, boolean biased) { return newHistogram(createName(klass, name, scope), biased); }
/** * Create a new {@link ValueDistributionMonitor} that is backed by a * {@code Yammer} {@link Histogram}. * @see MonitorRegistry#newValueDistributionMonitor(MonitorName) */ @Override public ValueDistributionMonitor newValueDistributionMonitor(final MonitorName monitorName) { final Histogram histogram = delegate.newHistogram(Utils.toMetricName(monitorName), true); return new YammerValueDistributionMonitor(histogram); }
public RunnerStats(MetricsRegistry registry) { this.normalRunners = registry.newCounter(MetricsConnection.class, "normalRunnersCount"); this.delayRunners = registry.newCounter(MetricsConnection.class, "delayRunnersCount"); this.delayIntevalHist = registry.newHistogram(MetricsConnection.class, "delayIntervalHist"); }
public Histogram getHistogram(MetricName metricName, MetricMatcher metricMatcher) { metricNamesForMetricMatchers.get(metricMatcher).add(metricName); return (Histogram) metricCache.get( metricName, (key) -> wavefrontHistograms ? WavefrontHistogram.get(metricsRegistry, key, this.nowMillis) : metricsRegistry.newHistogram(metricName, false)); }
public Histogram getHistogram(MetricName metricName, MetricMatcher metricMatcher) { metricNamesForMetricMatchers.get(metricMatcher).add(metricName); return (Histogram) metricCache.get( metricName, (key) -> wavefrontHistograms ? WavefrontHistogram.get(metricsRegistry, key, this.nowMillis) : metricsRegistry.newHistogram(metricName, false)); }
public CacheStats(final String name, int numPeriodsInWindow) { this.numPeriodsInWindow = numPeriodsInWindow; this.hitCounts = initializeZeros(numPeriodsInWindow); this.hitCachingCounts = initializeZeros(numPeriodsInWindow); this.requestCounts = initializeZeros(numPeriodsInWindow); this.requestCachingCounts = initializeZeros(numPeriodsInWindow); this.ageAtEviction = METRICS.newHistogram(CacheStats.class, name + ".ageAtEviction"); }
public static void main(String[] args) throws IOException, InterruptedException { // Parse inputs. System.out.println("Args: " + Joiner.on(", ").join(args)); if (args.length != 2) { System.out.println("Usage: java -jar this.jar <metricsPort> <histogramsPort>"); return; } int port = Integer.parseInt(args[0]); int histoPort = Integer.parseInt(args[1]); // Set up periodic reporting. MetricsRegistry metricsRegistry = new MetricsRegistry(); WavefrontYammerMetricsReporter wavefrontYammerMetricsReporter = new WavefrontYammerMetricsReporter(metricsRegistry, "wavefrontYammerMetrics", "localhost", port, histoPort, System::currentTimeMillis); wavefrontYammerMetricsReporter.start(5, TimeUnit.SECONDS); // Populate test metrics. Counter counter = metricsRegistry.newCounter(new TaggedMetricName("group", "mycounter", "tag1", "value1")); Histogram histogram = metricsRegistry.newHistogram(new TaggedMetricName("group2", "myhisto"), false); WavefrontHistogram wavefrontHistogram = WavefrontHistogram.get(metricsRegistry, new TaggedMetricName("group", "mywavefronthisto", "tag2", "value2")); while (true) { counter.inc(); histogram.update(counter.count()); wavefrontHistogram.update(counter.count()); Thread.sleep(1000); } }