private void reportYammerMetrics(long now) throws Exception { LOG.debug("Reporting yammer metrics."); YammerMetricProcessor.Context context = new YammerMetricProcessor.Context(this, now, _brokerId, _reportingIntervalMs); for (Map.Entry<com.yammer.metrics.core.MetricName, Metric> entry : Metrics.defaultRegistry().allMetrics().entrySet()) { LOG.trace("Processing yammer metric {}, scope = {}", entry.getKey(), entry.getKey().getScope()); entry.getValue().processWith(_yammerMetricProcessor, entry.getKey(), context); } LOG.debug("Finished reporting yammer metrics."); }
/** * Removes an existing metric */ public static void removeMetric(MetricsRegistry registry, MetricName name) { if (registry != null) { registry.removeMetric(name); } else { Metrics.defaultRegistry().removeMetric(name); } }
public void release() { Metrics.defaultRegistry().removeMetric(factory.createMetricName("ActiveTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CompletedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("TotalBlockedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CurrentlyBlockedTasks")); } }
public void release() { Metrics.defaultRegistry().removeMetric(factory.createMetricName("ActiveTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CompletedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("TotalBlockedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CurrentlyBlockedTasks")); } }
public void release() { Metrics.defaultRegistry().removeMetric(factory.createMetricName("Timeouts")); } }
ConsoleReporter reporter = new ConsoleReporter( Metrics.defaultRegistry(), System.out, MetricPredicate.ALL );
/** * Creates a new {@link GraphiteReporter}. * * @param host is graphite server * @param port is port on which graphite server is running * @param prefix is prepended to all names reported to graphite * @throws IOException if there is an error connecting to the Graphite server */ public GraphiteReporter(String host, int port, String prefix) throws IOException { this(Metrics.defaultRegistry(), host, port, prefix); }
/** * Creates a new {@link ConsoleReporter} for the default metrics registry, with unrestricted * output. * * @param out the {@link PrintStream} to which output will be written */ public ConsoleReporter(PrintStream out) { this(Metrics.defaultRegistry(), out, MetricPredicate.ALL); }
/** * Enables the console reporter for the default metrics registry, and causes it to print to * STDOUT with the specified period. * * @param period the period between successive outputs * @param unit the time unit of {@code period} */ public static void enable(long period, TimeUnit unit) { enable(Metrics.defaultRegistry(), period, unit); }
/** * Enables the CSV reporter for the default metrics registry, and causes it to write to files in * {@code outputDir} with the specified period. * * @param outputDir the directory in which {@code .csv} files will be created * @param period the period between successive outputs * @param unit the time unit of {@code period} */ public static void enable(File outputDir, long period, TimeUnit unit) { enable(Metrics.defaultRegistry(), outputDir, period, unit); }
/** * Instruments the given object. * * @param instance an object * @param <T> the type of the given {@code instance} * @return {@code instance}, instrumented */ public static <T> T instrument(T instance) { return instrument(Metrics.defaultRegistry(), instance); }
/** * Enables the graphite reporter to send data for the default metrics registry to graphite * server with the specified period. * * @param period the period between successive outputs * @param unit the time unit of {@code period} * @param host the host name of graphite server (carbon-cache agent) * @param port the port number on which the graphite server is listening */ public static void enable(long period, TimeUnit unit, String host, int port) { enable(Metrics.defaultRegistry(), period, unit, host, port); }
public static void shutdownMetrics(String indexerName) { SortedMap<String, SortedMap<MetricName, Metric>> groupedMetrics = Metrics.defaultRegistry().groupedMetrics( new IndexerMetricPredicate(indexerName)); for (SortedMap<MetricName, Metric> metricMap : groupedMetrics.values()) { for (MetricName metricName : metricMap.keySet()) { Metrics.defaultRegistry().removeMetric(metricName); } } }
public void stopReporter() { if (initialized && running) { running = false; underlying.shutdown(); log.info("Stopped TopicReporter instance"); underlying = new X(Metrics.defaultRegistry()); } }
public void release() { Metrics.defaultRegistry().removeMetric(factory.createMetricName("ActiveTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CompletedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("TotalBlockedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CurrentlyBlockedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("MaxPoolSize")); } }
/** * Creates a new {@link MetricsServlet}. */ public MetricsServletShim() { this(Clock.defaultClock(), VirtualMachineMetrics.getInstance(), Metrics.defaultRegistry(), DEFAULT_JSON_FACTORY, true); }
public static void enable(long period, TimeUnit unit, String apiKey, String host) { DatadogReporter dd = new DatadogReporter(Metrics.defaultRegistry(), apiKey, host); dd.start(period, unit); }
public void release() { Metrics.defaultRegistry().removeMetric(factory.createMetricName("CommandPendingTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CommandCompletedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CommandDroppedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("ResponsePendingTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("ResponseCompletedTasks")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("Timeouts")); }
/** * Creates a new {@link MetricsServlet}. * * @param showJvmMetrics whether or not JVM-level metrics will be included in the output */ public MetricsServlet(boolean showJvmMetrics) { this(Clock.defaultClock(), VirtualMachineMetrics.getInstance(), Metrics.defaultRegistry(), DEFAULT_JSON_FACTORY, showJvmMetrics); }
@Override public JmxReporter get() { if (metricsRegistry == Metrics.defaultRegistry()) { return JmxReporter.getDefault(); } final JmxReporter reporter = new JmxReporter(metricsRegistry); reporter.start(); return reporter; } }