當前位置: 首頁>>代碼示例>>Java>>正文


Java MetricRegistry.name方法代碼示例

本文整理匯總了Java中com.codahale.metrics.MetricRegistry.name方法的典型用法代碼示例。如果您正苦於以下問題:Java MetricRegistry.name方法的具體用法?Java MetricRegistry.name怎麽用?Java MetricRegistry.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.codahale.metrics.MetricRegistry的用法示例。


在下文中一共展示了MetricRegistry.name方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerMetric

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
static <T extends Metric> void registerMetric(final scala.Option<ActorRef> owner, final String metricName,
        final T metric) {
    if (owner.isEmpty()) {
       // there's no actor to monitor
        return;
    }

    String actorName = owner.get().path().toStringWithoutAddress();
    String fullName = MetricRegistry.name(actorName, metricName);

    MetricRegistry registry = MetricsReporter.getInstance(MeteringBehavior.DOMAIN).getMetricsRegistry();

    if (registry.getMetrics().containsKey(fullName)) {
        // already registered
        return;
    }

    try {
        registry.register(fullName, metric);
    } catch (IllegalArgumentException e) {
        // already registered - shouldn't happen here since we check above...
        LOG.debug("Unable to register '{}' in metrics registry: {}", e);
    }
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:25,代碼來源:MeteredBoundedMailbox.java

示例2: apply

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
/**
 * Uses 2 timers to measure message processing rate. One for overall message processing rate and
 * another to measure rate by message type. The timers are re-used if they were previously created.
 *
 * <p>
 * {@link com.codahale.metrics.MetricRegistry} maintains a reservoir for different timers where
 * collected timings are kept. It exposes various metrics for each timer based on collected
 * data. Eg: count of messages, 99, 95, 50... percentiles, max, mean etc.
 *
 * <p>
 * These metrics are exposed as JMX bean.
 *
 * @see <a href="http://dropwizard.github.io/metrics/manual/core/#timers">
 *     http://dropwizard.github.io/metrics/manual/core/#timers</a>
 *
 * @param message the message to process
 * @throws Exception on message failure
 */
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
public void apply(final Object message) throws Exception {
    final String messageType = message.getClass().getSimpleName();

    final String msgProcessingTimeByMsgType =
            MetricRegistry.name(actorQualifiedName, MSG_PROCESSING_RATE, messageType);

    final Timer msgProcessingTimerByMsgType = metricRegistry.timer(msgProcessingTimeByMsgType);

    //start timers
    final Timer.Context context = msgProcessingTimer.time();
    final Timer.Context contextByMsgType = msgProcessingTimerByMsgType.time();

    try {
        meteredActor.onReceive(message);
    } catch (Throwable e) {
        Throwables.propagateIfPossible(e, Exception.class);
        throw new RuntimeException(e);
    } finally {
        //stop timers
        contextByMsgType.stop();
        context.stop();
    }
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:44,代碼來源:MeteringBehavior.java

示例3: timer

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public static Timer timer(String first, String... keys) {
    String key = MetricRegistry.name(first, keys);
    return (Timer) metricCache.computeIfAbsent(key, (String metricName) -> {
        Timer metric = new Timer();
        registry.register(metricName, metric);
        return metric;
    });
}
 
開發者ID:StubbornJava,項目名稱:StubbornJava,代碼行數:9,代碼來源:Metrics.java

示例4: meter

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public static Meter meter(String first, String... keys) {
    String key = MetricRegistry.name(first, keys);
    return (Meter) metricCache.computeIfAbsent(key, (String metricName) -> {
        Meter metric = new Meter();
        registry.register(metricName, metric);
        return metric;
    });
}
 
開發者ID:StubbornJava,項目名稱:StubbornJava,代碼行數:9,代碼來源:Metrics.java

示例5: init

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
private void init(final String actorName) {
    actorQualifiedName = meteredActor.getSelf().path().parent().toStringWithoutAddress()
            + "/" + actorName;

    final String msgProcessingTime = MetricRegistry.name(actorQualifiedName, MSG_PROCESSING_RATE);
    msgProcessingTimer = metricRegistry.timer(msgProcessingTime);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:8,代碼來源:MeteringBehavior.java

示例6: submetric

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public TagEncodedMetricName submetric(String suffix) {
  return new TagEncodedMetricName(MetricRegistry.name(metricName, suffix), tags);
}
 
開發者ID:ApptuitAI,項目名稱:JInsight,代碼行數:4,代碼來源:TagEncodedMetricName.java

示例7: metricName

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
private static String metricName(String name) {
  return MetricRegistry.name(MetricsS3Decorator.class, name);
}
 
開發者ID:HubSpot,項目名稱:S3Decorators,代碼行數:4,代碼來源:MetricsS3Decorator.java

示例8: getOperationTimer

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public Timer getOperationTimer(String dataStoreType, String operationName) {
    final String rate = MetricRegistry.name(DISTRIBUTED_DATA_STORE_METRIC_REGISTRY, dataStoreType,
            operationName, METRIC_RATE);
    return metricRegistry.timer(rate);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:6,代碼來源:ActorContext.java

示例9: generateName

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
/**
 * Generates a name for a Metric from its component and feature.
 *
 * @param component component the metric is defined in
 * @param feature feature the metric is defined in
 * @param metricName local name of the metric
 *
 * @return full name of the metric
 */
private String generateName(final MetricsComponent component,
                            final MetricsFeature feature,
                            final String metricName) {
    return MetricRegistry.name(component.getName(),
                               feature.getName(),
                               metricName);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:17,代碼來源:MetricsManager.java


注:本文中的com.codahale.metrics.MetricRegistry.name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。