Java 类com.codahale.metrics.CsvReporter 实例源码

项目:jboot    文件:CSVReporter.java   
@Override
public void report(MetricRegistry metricRegistry) {

    JbootMetricsCVRReporterConfig cvrReporterConfig = Jboot.config(JbootMetricsCVRReporterConfig.class);

    if (StringUtils.isBlank(cvrReporterConfig.getPath())) {
        throw new NullPointerException("csv reporter path must not be null, please config jboot.metrics.reporter.cvr.path in you properties.");
    }

    final CsvReporter reporter = CsvReporter.forRegistry(metricRegistry)
            .formatFor(Locale.US)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build(new File(cvrReporterConfig.getPath()));

    reporter.start(1, TimeUnit.SECONDS);
}
项目:hadoop    文件:ResourceSchedulerWrapper.java   
private void initMetricsCSVOutput() {
  int timeIntervalMS = conf.getInt(
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS,
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS_DEFAULT);
  File dir = new File(metricsOutputDir + "/metrics");
  if(! dir.exists()
          && ! dir.mkdirs()) {
    LOG.error("Cannot create directory " + dir.getAbsoluteFile());
  }
  final CsvReporter reporter = CsvReporter.forRegistry(metrics)
          .formatFor(Locale.US)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build(new File(metricsOutputDir + "/metrics"));
  reporter.start(timeIntervalMS, TimeUnit.MILLISECONDS);
}
项目:aliyun-oss-hadoop-fs    文件:ResourceSchedulerWrapper.java   
private void initMetricsCSVOutput() {
  int timeIntervalMS = conf.getInt(
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS,
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS_DEFAULT);
  File dir = new File(metricsOutputDir + "/metrics");
  if(! dir.exists()
          && ! dir.mkdirs()) {
    LOG.error("Cannot create directory " + dir.getAbsoluteFile());
  }
  final CsvReporter reporter = CsvReporter.forRegistry(metrics)
          .formatFor(Locale.US)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build(new File(metricsOutputDir + "/metrics"));
  reporter.start(timeIntervalMS, TimeUnit.MILLISECONDS);
}
项目:aliyun-oss-hadoop-fs    文件:SLSCapacityScheduler.java   
private void initMetricsCSVOutput() {
  int timeIntervalMS = conf.getInt(
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS,
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS_DEFAULT);
  File dir = new File(metricsOutputDir + "/metrics");
  if(! dir.exists()
          && ! dir.mkdirs()) {
    LOG.error("Cannot create directory " + dir.getAbsoluteFile());
  }
  final CsvReporter reporter = CsvReporter.forRegistry(metrics)
          .formatFor(Locale.US)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build(new File(metricsOutputDir + "/metrics"));
  reporter.start(timeIntervalMS, TimeUnit.MILLISECONDS);
}
项目:big-c    文件:ResourceSchedulerWrapper.java   
private void initMetricsCSVOutput() {
  int timeIntervalMS = conf.getInt(
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS,
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS_DEFAULT);
  File dir = new File(metricsOutputDir + "/metrics");
  if(! dir.exists()
          && ! dir.mkdirs()) {
    LOG.error("Cannot create directory " + dir.getAbsoluteFile());
  }
  final CsvReporter reporter = CsvReporter.forRegistry(metrics)
          .formatFor(Locale.US)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build(new File(metricsOutputDir + "/metrics"));
  reporter.start(timeIntervalMS, TimeUnit.MILLISECONDS);
}
项目:incubator-omid    文件:CodahaleMetricsProvider.java   
private ScheduledReporter createAndGetConfiguredCSVReporter(String prefix, String csvDir) throws IOException {
    // NOTE:
    // 1) metrics output files are exclusive to a given process
    // 2) the output directory must exist
    // 3) if output files already exist they are not overwritten and there is no metrics output
    File outputDir;
    if (Strings.isNullOrEmpty(prefix)) {
        outputDir = new File(csvDir, prefix);
    } else {
        outputDir = new File(csvDir);
    }
    FileUtils.forceMkdir(outputDir);
    LOG.info("Configuring stats with csv output to directory [{}]", outputDir.getAbsolutePath());
    return CsvReporter.forRegistry(metrics)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build(outputDir);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ResourceSchedulerWrapper.java   
private void initMetricsCSVOutput() {
  int timeIntervalMS = conf.getInt(
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS,
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS_DEFAULT);
  File dir = new File(metricsOutputDir + "/metrics");
  if(! dir.exists()
          && ! dir.mkdirs()) {
    LOG.error("Cannot create directory " + dir.getAbsoluteFile());
  }
  final CsvReporter reporter = CsvReporter.forRegistry(metrics)
          .formatFor(Locale.US)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build(new File(metricsOutputDir + "/metrics"));
  reporter.start(timeIntervalMS, TimeUnit.MILLISECONDS);
}
项目:SPQR    文件:MetricsReporterFactory.java   
/**
 * Attaches a {@link CsvReporter} to provided {@link MetricsHandler}
 * @param metricsHandler
 * @param id
 * @param period
 * @param outputFile
 * @throws RequiredInputMissingException
 */
private static void attachCSVReporter(final MetricsHandler metricsHandler, final String id, final int period, final String outputFile) throws RequiredInputMissingException {

    //////////////////////////////////////////////////////////////////////////
    // validate input
    if(StringUtils.isBlank(id))
        throw new RequiredInputMissingException("Missing required metric reporter id");
    if(metricsHandler == null)
        throw new RequiredInputMissingException("Missing required metrics handler");
    if(StringUtils.isBlank(outputFile))
        throw new RequiredInputMissingException("Missing required output file for CSV metrics writer");
    File oFile = new File(outputFile);
    if(oFile.isDirectory())
        throw new RequiredInputMissingException("Output file points to directory");
    //////////////////////////////////////////////////////////////////////////

    final CsvReporter reporter = CsvReporter.forRegistry(metricsHandler.getRegistry())
            .formatFor(Locale.US).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS)
               .build(oFile);
    reporter.start((period > 0 ? period : 1), TimeUnit.SECONDS);
    metricsHandler.addScheduledReporter(id, reporter);
}
项目:hops    文件:ResourceSchedulerWrapper.java   
private void initMetricsCSVOutput() {
  int timeIntervalMS = conf.getInt(
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS,
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS_DEFAULT);
  File dir = new File(metricsOutputDir + "/metrics");
  if(! dir.exists()
          && ! dir.mkdirs()) {
    LOG.error("Cannot create directory " + dir.getAbsoluteFile());
  }
  final CsvReporter reporter = CsvReporter.forRegistry(metrics)
          .formatFor(Locale.US)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build(new File(metricsOutputDir + "/metrics"));
  reporter.start(timeIntervalMS, TimeUnit.MILLISECONDS);
}
项目:hadoop-on-lustre2    文件:ResourceSchedulerWrapper.java   
private void initMetricsCSVOutput() {
  int timeIntervalMS = conf.getInt(
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS,
          SLSConfiguration.METRICS_RECORD_INTERVAL_MS_DEFAULT);
  File dir = new File(metricsOutputDir + "/metrics");
  if(! dir.exists()
          && ! dir.mkdirs()) {
    LOG.error("Cannot create directory " + dir.getAbsoluteFile());
  }
  final CsvReporter reporter = CsvReporter.forRegistry(metrics)
          .formatFor(Locale.US)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build(new File(metricsOutputDir + "/metrics"));
  reporter.start(timeIntervalMS, TimeUnit.MILLISECONDS);
}
项目:perf-agent    文件:MetricReporter.java   
public static void enableCSVReporter() {
  LOGGER.info("Init CSV Reporter");

  String tempDir = System.getProperty("java.io.tmpdir");
  File tempFile = new File(tempDir);
  File outputDir = new File(tempFile, "/perf-agent/");
  if (!outputDir.exists()) {
    outputDir.mkdirs();
  }

  final CsvReporter reporter = CsvReporter.forRegistry(METRIC_REGISTRY).formatFor(Locale.US).convertRatesTo(TimeUnit.SECONDS)
    .convertDurationsTo(TimeUnit.MILLISECONDS).build(outputDir);
  reporter.start(1, TimeUnit.MINUTES);

  LOGGER.info("CSV File generated on:" + outputDir.getAbsolutePath());
}
项目:cdk    文件:StartReportingMetricsToCSVBuilder.java   
@Override
protected void doNotify(Record notification) {
  for (Object event : Notifications.getLifecycleEvents(notification)) {
    if (event == Notifications.LifecycleEvent.SHUTDOWN) {
      synchronized (REGISTRIES) {
        Map<File, CsvReporter> reporters = REGISTRIES.get(getContext().getMetricRegistry());
        if (reporters != null) {
          CsvReporter reporter = reporters.remove(outputDir);
          if (reporter != null) {
            reporter.stop();
          }
        }
      }
    }
  }
  super.doNotify(notification);
}
项目:fluo    文件:CsvReporterStarter.java   
@Override
public List<AutoCloseable> start(Params params) {
  SimpleConfiguration config =
      new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("csv");

  String dir = config.getString("dir", "");
  if (!config.getBoolean("enable", false) || dir.isEmpty()) {
    return Collections.emptyList();
  }

  TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
  TimeUnit durationUnit =
      TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());

  CsvReporter reporter = CsvReporter.forRegistry(params.getMetricRegistry())
      .convertDurationsTo(durationUnit).convertRatesTo(rateUnit).build(new File(dir));
  reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);

  log.info("Reporting metrics as csv to directory {}", dir);

  return Collections.singletonList((AutoCloseable) reporter);
}
项目:graylog-plugin-metrics-reporter    文件:MetricsCsvReporterModule.java   
@Override
protected void configure() {
    bind(CsvReporter.class).toProvider(CsvReporterProvider.class);

    addConfigBeans();
    addInitializer(MetricsCsvReporterService.class);
}
项目:graylog-plugin-metrics-reporter    文件:CsvReporterProvider.java   
@Override
public CsvReporter get() {
    return CsvReporter.forRegistry(metricRegistry)
            .formatFor(configuration.getLocale())
            .convertDurationsTo(configuration.getUnitDurations())
            .convertRatesTo(configuration.getUnitRates())
            .filter(new RegexMetricFilter(configuration.getIncludeMetrics()))
            .build(configuration.getDirectory());
}
项目:polygene-java    文件:CodahaleMetricsAssembler.java   
public CodahaleMetricsAssembler withCsvReporter( File outDirectory, long period, TimeUnit timeunit )
{
    declaration.reportersFactories.add( metricRegistry -> {
        CsvReporter reporter = CsvReporter.forRegistry( metricRegistry ).build( outDirectory );
        reporter.start( period, timeunit );
        return reporter;
    });
    return this;
}
项目:baleen    文件:ReporterUtils.java   
/**
 * Create a new CSV reporter.
 *
 * @param metricRegistry
 *            the registry to report on
 * @param config
 *            the configuration map (see {@link MetricsFactory})
 * @return the reporter instance
 */
public static ScheduledReporter createCsvReporter(MetricRegistry metricRegistry, Map<String, Object> config)
    throws BaleenException{
    String directoryPath = (String) config.getOrDefault("directory", "metrics");
    File directory = new File(directoryPath);

    if (!directory.exists() && !directory.mkdirs()){
        throw new BaleenException("Unable to create directories for CSV Reporter");
    }

    return CsvReporter.forRegistry(metricRegistry).convertRatesTo(getRatesUnit(config))
            .convertDurationsTo(getDurationUnit(config)).build(directory);
}
项目:appengine-hibernate    文件:Metrics.java   
public static void start() {
    File metricsOut = new File("target/metrics");
    if(!metricsOut.exists()) {
        metricsOut.mkdirs();
    }
    CSV_REPORTER = CsvReporter.forRegistry(REGISTRY).build(metricsOut);
    CSV_REPORTER.start(10, TimeUnit.SECONDS);
}
项目:spectator-examples    文件:Main.java   
@Inject
ReportersManager(MetricRegistry codaRegistry) {
  jmx = JmxReporter.forRegistry(codaRegistry).build();
  jmx.start();

  File dir = new File("./build/metrics");
  dir.mkdirs();
  csv = CsvReporter.forRegistry(codaRegistry).build(dir);
  csv.start(5, TimeUnit.SECONDS);
}
项目:camel-metrics    文件:CsvReporterDefinition.java   
/**
 * @param metricRegistry
 * @return
 */
public CsvReporter buildReporter(final MetricRegistry metricRegistry, final Exchange creatingExchange, final MetricGroup metricGroup) {
    CsvReporterDefinition definitionWithDefaults = getReporterDefinitionWithDefaults();

    final String filterValue = evaluateValue(definitionWithDefaults.getFilter(), definitionWithDefaults.getRuntimeFilter(), definitionWithDefaults.getRuntimeSimpleFilter(), creatingExchange);
    final String directoryValue = evaluateValue(definitionWithDefaults.getDirectory(), definitionWithDefaults.getRuntimeDirectory(), definitionWithDefaults.getRuntimeSimpleDirectory(), creatingExchange);

    // @formatter:off
    CsvReporter csvReporter = CsvReporter
            .forRegistry(metricRegistry)
            .convertDurationsTo(definitionWithDefaults.getDurationUnit())
            .convertRatesTo(definitionWithDefaults.getRateUnit())
            .filter(new MetricFilter(){
                @Override
                public boolean matches(final String name, final Metric metric) {
                    if(!metricGroup.contains(metric)){
                        return false;
                    }
                    if(name==null || filterValue==null){
                        return true;
                    }
                    boolean result = name.matches(filterValue);
                    return result;
                }
            })
            .build(new File(directoryValue));
    // @formatter:on
    return csvReporter;
}
项目:joinery    文件:Metrics.java   
public static void displayMetrics() {
    ConsoleReporter.forRegistry(registry)
            .build()
            .report();
    CsvReporter.forRegistry(registry)
            .build(new File("target/"))
            .report();
}
项目:metrics-sql    文件:CsvReportingTest.java   
@Before
public void setUp() throws SQLException, IOException {
    csvFolder = tmpFolderRule.newFolder("csv");
    mBeanServer=ManagementFactory.getPlatformMBeanServer();
    metricRegistry = new MetricRegistry();
    csvReporter = CsvReporter.forRegistry(metricRegistry)
            .build(csvFolder);
    proxyFactory = new JdbcProxyFactory(metricRegistry, new DefaultMetricNamingStrategy("csv"));
    rawDataSource = H2DbUtil.createDataSource();
    try(Connection connection = rawDataSource.getConnection()) {
        H2DbUtil.initTable(connection);
    }
    dataSource = proxyFactory.wrapDataSource(rawDataSource);
}
项目:pravega    文件:StatsProviderImpl.java   
@Synchronized
@Override
public void start() {
    init();

    if (conf.isEnableCSVReporter()) {
        // NOTE:  metrics output files are exclusive to a given process
        File outdir;
        if (!Strings.isNullOrEmpty(conf.getMetricsPrefix())) {
            outdir = new File(conf.getCsvEndpoint(), conf.getMetricsPrefix());
        } else {
            outdir = new File(conf.getCsvEndpoint());
        }
        outdir.mkdirs();
        log.info("Configuring stats with csv output to directory [{}]", outdir.getAbsolutePath());
        reporters.add(CsvReporter.forRegistry(getMetrics())
                      .convertRatesTo(TimeUnit.SECONDS)
                      .convertDurationsTo(TimeUnit.MILLISECONDS)
                      .build(outdir));
    }
    if (conf.isEnableStatsdReporter()) {
        log.info("Configuring stats with statsD at {}:{}", conf.getStatsDHost(), conf.getStatsDPort());
        reporters.add(StatsDReporter.forRegistry(getMetrics())
                      .build(conf.getStatsDHost(), conf.getStatsDPort()));
    }
    if (conf.isEnableGraphiteReporter()) {
        log.info("Configuring stats with graphite at {}:{}", conf.getGraphiteHost(), conf.getGraphitePort());
        final Graphite graphite = new Graphite(new InetSocketAddress(conf.getGraphiteHost(), conf.getGraphitePort()));
        reporters.add(GraphiteReporter.forRegistry(getMetrics())
            .prefixedWith(conf.getMetricsPrefix())
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .filter(MetricFilter.ALL)
            .build(graphite));
    }
    if (conf.isEnableJMXReporter()) {
        log.info("Configuring stats with jmx {}", conf.getJmxDomain());
        final JmxReporter jmx = JmxReporter.forRegistry(getMetrics())
            .inDomain(conf.getJmxDomain())
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        jmx.start();
    }
    if (conf.isEnableGangliaReporter()) {
        try {
            log.info("Configuring stats with ganglia at {}:{}", conf.getGangliaHost(), conf.getGangliaPort());
            final GMetric ganglia = new GMetric(conf.getGangliaHost(), conf.getGangliaPort(), GMetric.UDPAddressingMode.MULTICAST, 1);
            reporters.add(GangliaReporter.forRegistry(getMetrics())
                .prefixedWith(conf.getMetricsPrefix())
                .convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.MILLISECONDS)
                .build(ganglia));
        } catch (IOException e) {
            log.warn("ganglia create failure: {}", e);
        }
    }
    if (conf.isEnableConsoleReporter()) {
        log.info("Configuring console reporter");
        reporters.add(ConsoleReporter.forRegistry(getMetrics())
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build());
    }
    for (ScheduledReporter r : reporters) {
        r.start(conf.getStatsOutputFrequencySeconds(), TimeUnit.SECONDS);
    }
}
项目:graylog-plugin-metrics-reporter    文件:MetricsCsvReporterService.java   
@Inject
public MetricsCsvReporterService(CsvReporter csvReporter, MetricsCsvReporterConfiguration configuration) {
    this.csvReporter = requireNonNull(csvReporter);
    this.configuration = requireNonNull(configuration);
}
项目:graylog-plugin-metrics-reporter    文件:CsvReporterProviderTest.java   
@Test
public void get() throws Exception {
    final CsvReporterProvider provider = new CsvReporterProvider(new MetricsCsvReporterConfiguration(), new MetricRegistry());
    final CsvReporter reporter = provider.get();
    assertNotNull(reporter);
}
项目:werval    文件:MetricsPlugin.java   
private void registerMetricsReporters( Application application, MetricRegistry metrics )
{
    Config config = application.config().atKey( "metrics" );

    reporters = new ArrayList<>();

    // JMX Reporter
    if( config.bool( "reports.jmx.enabled" ) )
    {
        JmxReporter jmx = JmxReporter.forRegistry( metrics )
            .convertRatesTo( TimeUnit.SECONDS )
            .convertDurationsTo( TimeUnit.MILLISECONDS )
            .build();
        jmx.start();
        reporters.add( jmx );
    }

    // Console Reporter
    if( config.bool( "reports.console.enabled" ) )
    {
        ConsoleReporter console = ConsoleReporter.forRegistry( metrics )
            .convertRatesTo( TimeUnit.SECONDS )
            .convertDurationsTo( TimeUnit.MILLISECONDS )
            .build();
        console.start( config.seconds( "reports.console.periodicity" ), TimeUnit.SECONDS );
        reporters.add( console );
    }

    // SLF4J Reporter
    if( config.bool( "reports.slf4j.enabled" ) )
    {
        final Slf4jReporter slf4j = Slf4jReporter.forRegistry( metrics )
            .outputTo( LoggerFactory.getLogger( config.string( "reports.slf4j.logger" ) ) )
            .withLoggingLevel(
                Slf4jReporter.LoggingLevel.valueOf( config.string( "reports.slf4j.level" ).toUpperCase( US ) )
            )
            .markWith( MarkerFactory.getMarker( "metrics" ) )
            .convertRatesTo( TimeUnit.SECONDS )
            .convertDurationsTo( TimeUnit.MILLISECONDS )
            .build();
        slf4j.start( config.seconds( "reports.slf4j.periodicity" ), TimeUnit.SECONDS );
        reporters.add( slf4j );
    }

    // CSV Reporter
    if( config.bool( "reports.csv.enabled" ) )
    {
        File csvReportDir = new File( config.string( "reports.csv.directory" ) );
        csvReportDir.mkdirs();
        final CsvReporter csv = CsvReporter.forRegistry( metrics )
            .formatFor( Locale.forLanguageTag( config.string( "reports.csv.locale" ) ) )
            .convertRatesTo( TimeUnit.SECONDS )
            .convertDurationsTo( TimeUnit.MILLISECONDS )
            .build( csvReportDir );
        csv.start( config.seconds( "reports.csv.periodicity" ), TimeUnit.SECONDS );
        reporters.add( csv );
    }
}
项目:cdk    文件:StartReportingMetricsToCSVBuilder.java   
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()));
  }
  Locale locale = getConfigs().getLocale(config, "locale", Locale.getDefault());
  this.outputDir = new File(getConfigs().getString(config, "outputDir"));
  validateArguments();

  MetricRegistry registry = context.getMetricRegistry();
  synchronized (REGISTRIES) {
    Map<File, CsvReporter> reporters = REGISTRIES.get(registry);
    if (reporters == null) {
      reporters = new HashMap();
      REGISTRIES.put(registry, reporters);
    }
    CsvReporter reporter = reporters.get(outputDir);
    if (reporter == null) {
      Builder reporterBuilder = CsvReporter.forRegistry(registry)
          .filter(filter)
          .convertDurationsTo(defaultDurationUnit)
          .convertRatesTo(defaultRateUnit)
          .formatFor(locale);

      reporter = reporterBuilder.build(outputDir);
      outputDir.mkdirs();
      if (!outputDir.isDirectory()) {
        throw new MorphlineCompilationException("Directory not found: " + outputDir, config);
      }
      if (!outputDir.canWrite()) {
        throw new MorphlineCompilationException("Directory not writeable: " + outputDir, config);
      }
      reporter.start(frequency, TimeUnit.NANOSECONDS);
      reporters.put(outputDir, reporter);
    }
  }
}