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


Java GraphiteReporter.forRegistry方法代码示例

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


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

示例1: start

import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@Override
public void start() throws Exception {
  if (!graphiteConfiguration.isEnabled()) {
    LOG.info("Not reporting data points to graphite.");
    return;
  }

  final String prefix = buildGraphitePrefix();

  LOG.info("Reporting data points to graphite server {}:{} every {} seconds with prefix '{}' and predicates '{}'.", graphiteConfiguration.getHostname(),
      graphiteConfiguration.getPort(), graphiteConfiguration.getPeriodSeconds(), prefix, JavaUtils.COMMA_JOINER.join(graphiteConfiguration.getPredicates()));

  final Graphite graphite = new Graphite(new InetSocketAddress(graphiteConfiguration.getHostname(), graphiteConfiguration.getPort()));

  final GraphiteReporter.Builder reporterBuilder = GraphiteReporter.forRegistry(registry);

  if (!Strings.isNullOrEmpty(prefix)) {
    reporterBuilder.prefixedWith(prefix);
  }

  if (!graphiteConfiguration.getPredicates().isEmpty()) {
    reporterBuilder.filter(new MetricFilter() {
      @Override
      public boolean matches(String name, Metric metric) {
        for (String predicate : graphiteConfiguration.getPredicates()) {
          if (name.startsWith(predicate)) {
            return true;
          }
        }
        return false;
      }
    });
  }

  reporter = Optional.of(reporterBuilder.build(graphite));
  reporter.get().start(graphiteConfiguration.getPeriodSeconds(), TimeUnit.SECONDS);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:38,代码来源:SingularityGraphiteReporterManaged.java

示例2: start

import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@Override
public void start() throws Exception {
  if (!graphiteConfiguration.isEnabled()) {
    LOG.info("Not reporting data points to graphite.");
    return;
  }

  final String prefix = buildGraphitePrefix();
  final Map<String, String> tags = buildGraphiteTags();

  LOG.info("Reporting data points to graphite server {}:{} every {} seconds with prefix '{}', predicates '{}', and tags '{}'.", graphiteConfiguration.getHostname(),
      graphiteConfiguration.getPort(), graphiteConfiguration.getPeriodSeconds(), prefix, JavaUtils.COMMA_JOINER.join(graphiteConfiguration.getPredicates()), JavaUtils.COMMA_EQUALS_MAP_JOINER.join(tags));

  graphite = new GraphiteWithTags(new InetSocketAddress(graphiteConfiguration.getHostname(), graphiteConfiguration.getPort()), SocketFactory.getDefault(), Charsets.UTF_8, tags);

  final GraphiteReporter.Builder reporterBuilder = GraphiteReporter.forRegistry(registry);

  if (!Strings.isNullOrEmpty(prefix)) {
    reporterBuilder.prefixedWith(prefix);
  }

  if (!graphiteConfiguration.getPredicates().isEmpty()) {
    reporterBuilder.filter(new MetricFilter() {
      @Override
      public boolean matches(String name, Metric metric) {
        for (String predicate : graphiteConfiguration.getPredicates()) {
          if (name.startsWith(predicate)) {
            return true;
          }
        }
        return false;
      }
    });
  }

  reporter = reporterBuilder.build(graphite);
  reporter.start(graphiteConfiguration.getPeriodSeconds(), TimeUnit.SECONDS);
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:39,代码来源:SingularityGraphiteReporterManaged.java

示例3: start

import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@Override
public void start() throws Exception {
  if (!graphiteConfiguration.isEnabled()) {
    LOG.info("Not reporting data points to graphite.");
    return;
  }

  LOG.info("Reporting data points to graphite server {}:{} every {} seconds with prefix '{}' and predicates '{}'.", graphiteConfiguration.getHostname(),
      graphiteConfiguration.getPort(), graphiteConfiguration.getPeriodSeconds(), graphiteConfiguration.getPrefix(), JavaUtils.COMMA_JOINER.join(graphiteConfiguration.getPredicates()));

  final Graphite graphite = new Graphite(new InetSocketAddress(graphiteConfiguration.getHostname(), graphiteConfiguration.getPort()));

  final GraphiteReporter.Builder reporterBuilder = GraphiteReporter.forRegistry(registry);

  if (!Strings.isNullOrEmpty(graphiteConfiguration.getPrefix())) {
    reporterBuilder.prefixedWith(graphiteConfiguration.getPrefix());
  }

  if (!graphiteConfiguration.getPredicates().isEmpty()) {
    reporterBuilder.filter(new MetricFilter() {
      @Override
      public boolean matches(String name, Metric metric) {
        for (String predicate : graphiteConfiguration.getPredicates()) {
          if (name.startsWith(predicate)) {
            return true;
          }
        }
        return false;
      }
    });
  }

  reporter = Optional.of(reporterBuilder.build(graphite));
  reporter.get().start(graphiteConfiguration.getPeriodSeconds(), TimeUnit.SECONDS);
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:36,代码来源:BaragonAgentGraphiteReporterManaged.java

示例4: start

import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@Override
public void start() throws Exception {
  if (!graphiteConfiguration.isEnabled()) {
    LOG.info("Not reporting data points to graphite.");
    return;
  }

  final String prefix = buildGraphitePrefix();

  LOG.info("Reporting data points to graphite server {}:{} every {} seconds with prefix '{}' and predicates '{}'.", graphiteConfiguration.getHostname(),
      graphiteConfiguration.getPort(), graphiteConfiguration.getPeriodSeconds(), graphiteConfiguration.getPrefix(), JavaUtils.COMMA_JOINER.join(graphiteConfiguration.getPredicates()));

  final Graphite graphite = new Graphite(new InetSocketAddress(graphiteConfiguration.getHostname(), graphiteConfiguration.getPort()));

  final GraphiteReporter.Builder reporterBuilder = GraphiteReporter.forRegistry(registry);

  if (!Strings.isNullOrEmpty(graphiteConfiguration.getPrefix())) {
    reporterBuilder.prefixedWith(prefix);
  }

  if (!graphiteConfiguration.getPredicates().isEmpty()) {
    reporterBuilder.filter(new MetricFilter() {
      @Override
      public boolean matches(String name, Metric metric) {
        for (String predicate : graphiteConfiguration.getPredicates()) {
          if (name.startsWith(predicate)) {
            return true;
          }
        }
        return false;
      }
    });
  }

  reporter = Optional.of(reporterBuilder.build(graphite));
  reporter.get().start(graphiteConfiguration.getPeriodSeconds(), TimeUnit.SECONDS);
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:38,代码来源:BaragonGraphiteReporterManaged.java

示例5: getBuilder

import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
GraphiteReporter.Builder getBuilder(MetricRegistry metricRegistry) {
    return GraphiteReporter.forRegistry(metricRegistry);
}
 
开发者ID:jhipster,项目名称:jhipster,代码行数:4,代码来源:GraphiteRegistry.java


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