当前位置: 首页>>代码示例>>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;未经允许,请勿转载。