當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。