当前位置: 首页>>代码示例>>Java>>正文


Java MetricFilter.matches方法代码示例

本文整理汇总了Java中com.codahale.metrics.MetricFilter.matches方法的典型用法代码示例。如果您正苦于以下问题:Java MetricFilter.matches方法的具体用法?Java MetricFilter.matches怎么用?Java MetricFilter.matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codahale.metrics.MetricFilter的用法示例。


在下文中一共展示了MetricFilter.matches方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFilter

import com.codahale.metrics.MetricFilter; //导入方法依赖的package包/类
/**
 * Gets a {@link MetricFilter} that specifically includes and excludes configured metrics. This method needs the
 * existing {@link MetricFilter} used to filter the disabled metrics. The includes and excludes will be checked
 * only for enabled metrics.
 *
 * @param enabledFilter The existing {@link MetricFilter} to filter disabled metrics.
 * @return the filter for selecting metrics based on the configured excludes/includes.
 * @throws ReporterBuildException if the pattern compilation failed for regular expressions.
 */
protected MetricFilter getFilter(MetricFilter enabledFilter) throws ReporterBuildException {
    if (includes.isEmpty() && excludes.isEmpty()) {
        return enabledFilter;
    }

    final StringMatchingStrategy stringMatchingStrategy;

    if (useRegexFilters) {
        stringMatchingStrategy = regexStringMatchingStrategy;
        compileAllRegex(getIncludes());
        compileAllRegex(getExcludes());
    } else {
        stringMatchingStrategy = defaultStringMatchingStrategy;
    }

    return (name, metric) -> {
        // Include the metric if its name is not excluded and its name is included
        // Where, by default, with no includes setting, all names are included.
        return enabledFilter.matches(name, metric) && !stringMatchingStrategy.containsMatch(getExcludes(), name) &&
                (getIncludes().isEmpty() || stringMatchingStrategy.containsMatch(getIncludes(), name));
    };
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:32,代码来源:ReporterConfig.java

示例2: removeMatching

import com.codahale.metrics.MetricFilter; //导入方法依赖的package包/类
/**
 * Removes all metrics which match the given filter.
 *
 * @param filter a filter
 */
public final void removeMatching(final MetricFilter filter) {
	for(Map.Entry<String, Metric> entry : metrics.entrySet()) {
		if(filter.matches(entry.getKey(), entry.getValue())) {
			remove(entry.getKey());
		}
	}
}
 
开发者ID:emc-mongoose,项目名称:mongoose-base,代码行数:13,代码来源:CustomMetricRegistry.java

示例3: getMetrics

import com.codahale.metrics.MetricFilter; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <T extends Metric> SortedMap<String, T> getMetrics(
	final Class<T> klass, final MetricFilter filter
) {
	final TreeMap<String, T> timers = new TreeMap<String, T>();
	for(final Map.Entry<String, Metric> entry : metrics.entrySet()) {
		if(klass.isInstance(entry.getValue()) && filter.matches(entry.getKey(),
			entry.getValue())) {
			timers.put(entry.getKey(), (T) entry.getValue());
		}
	}
	return Collections.unmodifiableSortedMap(timers);
}
 
开发者ID:emc-mongoose,项目名称:mongoose-base,代码行数:14,代码来源:CustomMetricRegistry.java

示例4: matches

import com.codahale.metrics.MetricFilter; //导入方法依赖的package包/类
private Predicate<Map.Entry<String, Gauge>> matches(final MetricFilter filter) {
  return new Predicate<Map.Entry<String, Gauge>>() {
    @Override
    public boolean apply(final Map.Entry<String, Gauge> entry) {
      return filter.matches(entry.getKey(), entry.getValue());
    }
  };
}
 
开发者ID:apache,项目名称:beam,代码行数:9,代码来源:WithMetricsSupport.java

示例5: removeMatching

import com.codahale.metrics.MetricFilter; //导入方法依赖的package包/类
@Override
public void removeMatching(MetricFilter filter) {
  for (Map.Entry<String, Metric> entry : this.contextAwareMetrics.entrySet()) {
    if (filter.matches(entry.getKey(), entry.getValue())) {
      remove(entry.getKey());
    }
  }
}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:9,代码来源:MetricContext.java


注:本文中的com.codahale.metrics.MetricFilter.matches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。