本文整理了Java中com.yammer.metrics.Metrics.defaultRegistry()
方法的一些代码示例,展示了Metrics.defaultRegistry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metrics.defaultRegistry()
方法的具体详情如下:
包路径:com.yammer.metrics.Metrics
类名称:Metrics
方法名:defaultRegistry
[英]Returns the (static) default registry.
[中]返回(静态)默认注册表。
代码示例来源:origin: linkedin/cruise-control
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.");
}
代码示例来源:origin: apache/incubator-pinot
/**
* Removes an existing metric
*/
public static void removeMetric(MetricsRegistry registry, MetricName name) {
if (registry != null) {
registry.removeMetric(name);
} else {
Metrics.defaultRegistry().removeMetric(name);
}
}
代码示例来源:origin: lealone/Lealone
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"));
}
}
代码示例来源:origin: lealone/Lealone
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"));
}
}
代码示例来源:origin: lealone/Lealone
public void release() {
Metrics.defaultRegistry().removeMetric(factory.createMetricName("Timeouts"));
}
}
代码示例来源:origin: apache/usergrid
ConsoleReporter reporter = new ConsoleReporter( Metrics.defaultRegistry(), System.out, MetricPredicate.ALL );
代码示例来源:origin: com.yammer.metrics/metrics-graphite
/**
* 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);
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* 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);
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* 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);
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* 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);
}
代码示例来源:origin: com.yammer.metrics/metrics-aop
/**
* 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);
}
代码示例来源:origin: com.yammer.metrics/metrics-graphite
/**
* 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);
}
代码示例来源:origin: NGDATA/hbase-indexer
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);
}
}
}
代码示例来源:origin: amient/kafka-metrics
public void stopReporter() {
if (initialized && running) {
running = false;
underlying.shutdown();
log.info("Stopped TopicReporter instance");
underlying = new X(Metrics.defaultRegistry());
}
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server
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"));
}
}
代码示例来源:origin: addthis/hydra
/**
* Creates a new {@link MetricsServlet}.
*/
public MetricsServletShim() {
this(Clock.defaultClock(), VirtualMachineMetrics.getInstance(),
Metrics.defaultRegistry(), DEFAULT_JSON_FACTORY, true);
}
代码示例来源:origin: vistarmedia/metrics-datadog
public static void enable(long period, TimeUnit unit, String apiKey,
String host) {
DatadogReporter dd = new DatadogReporter(Metrics.defaultRegistry(), apiKey,
host);
dd.start(period, unit);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server
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"));
}
代码示例来源:origin: com.yammer.metrics/metrics-servlet
/**
* 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);
}
代码示例来源:origin: com.yammer.metrics/metrics-guice
@Override
public JmxReporter get() {
if (metricsRegistry == Metrics.defaultRegistry()) {
return JmxReporter.getDefault();
}
final JmxReporter reporter = new JmxReporter(metricsRegistry);
reporter.start();
return reporter;
}
}
内容来源于网络,如有侵权,请联系作者删除!