Package com.codahale.metrics

Examples of com.codahale.metrics.MetricFilter


      "\n \"*\" : \"*\"" +
      "\n }" +
      "\n }}";

    Config config = ConfigFactory.parseString(str);
    MetricFilter filter = PatternMetricFilter.parse(new Configs(), config);
    assertNotSame(filter, MetricFilter.ALL);
    assertTrue(filter.matches("foo", new Counter()));
    assertTrue(filter.matches("boo", new Counter()));
    assertTrue(filter.toString().length() > 0);
  }
View Full Code Here


    private static final Map<MetricRegistry, Map<String, JmxReporter>> REGISTRIES = new IdentityHashMap();
   
    public StartReportingMetricsToJMX(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);     
     
      MetricFilter filter = PatternMetricFilter.parse(getConfigs(), config);
      TimeUnit defaultDurationUnit = getConfigs().getTimeUnit(config, "defaultDurationUnit", TimeUnit.MILLISECONDS);
      TimeUnit defaultRateUnit = getConfigs().getTimeUnit(config, "defaultRateUnit", TimeUnit.SECONDS);
     
      Map<String, TimeUnit> durationUnits = new HashMap();
      Config durationUnitsConfig = getConfigs().getConfig(config, "durationUnits", ConfigFactory.empty());
View Full Code Here

    private static final Map<MetricRegistry, Map<File, CsvReporter>> REGISTRIES = new IdentityHashMap();
   
    public StartReportingMetricsToCSV(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);     
     
      MetricFilter filter = PatternMetricFilter.parse(getConfigs(), config);
      TimeUnit defaultDurationUnit = getConfigs().getTimeUnit(config, "defaultDurationUnit", TimeUnit.MILLISECONDS);
      TimeUnit defaultRateUnit = getConfigs().getTimeUnit(config, "defaultRateUnit", TimeUnit.SECONDS);
      long frequency = getConfigs().getNanoseconds(config, "frequency", 10 * 1000L * 1000 * 1000); // 10 seconds
      if (LOG.isTraceEnabled()) {
        LOG.trace("availableLocales: {}", Joiner.on("\n").join(Locale.getAvailableLocales()));
View Full Code Here

    return MetricFilter.ALL;
  }

  protected MetricFilter metricFilterPattern(String pattern) {
    final Pattern filter = Pattern.compile(pattern);
    return new MetricFilter() {

      @Override
      public boolean matches(String name, Metric metric) {
        return filter.matcher(name).matches();
      }
View Full Code Here

  public static MetricRegistry getInstance() {
    return RegistryHolder.REGISTRY;
  }

  public static void resetMetrics(){
    RegistryHolder.REGISTRY.removeMatching(new MetricFilter(){
      @Override
      public boolean matches(String name, Metric metric) {
        return true;
      }});
    RegistryHolder.registerSysStats();
View Full Code Here

  private RequestMonitor.RequestInformation<HttpRequestTrace> requestInformation2;
  private RequestMonitor.RequestInformation<HttpRequestTrace> requestInformation3;

  @Before
  public void clearState() {
    getMetricRegistry().removeMatching(new MetricFilter() {
      @Override
      public boolean matches(String name, Metric metric) {
        return true;
      }
    });
View Full Code Here

    return doMetrics(prefix);
  }

  private MetricRegistry doMetrics(final String prefix){

    MetricFilter filter = new MetricFilter(){

      @Override
      public boolean matches(String name, Metric metric){
        return name.startsWith(prefix);
      }
    };

    Map<String, Metric> metrics = this.metricRegistry.getMetrics();

    MetricRegistry result = new MetricRegistry();

    Collection<Map.Entry<String, Metric>> entries = metrics.entrySet();
    for(Map.Entry<String, Metric> entry : entries){
      String name = entry.getKey();
      Metric metric = entry.getValue();

      if(!filter.matches(name, metric)){
        continue;
      }

      // Strip prefix
      name = name.substring(prefix.length());
View Full Code Here

    }

    final
    String prefix = createName(id) + ".";

    MetricFilter filter = new MetricFilter(){

      @Override
      public boolean matches(String name, Metric metric){
        return name.startsWith(prefix);
      }
View Full Code Here

TOP

Related Classes of com.codahale.metrics.MetricFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.