Package com.codahale.metrics

Examples of com.codahale.metrics.CsvReporter


    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);
  }
View Full Code Here


    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);
  }
View Full Code Here

        Map<File, CsvReporter> reporters = REGISTRIES.get(registry);
        if (reporters == null) {
          reporters = Maps.newHashMap();
          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);
        }
      }
    }
View Full Code Here

      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();
              }
            }
          }
        }
      }
View Full Code Here

        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);
        }
      }
    }
View Full Code Here

      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();
              }
            }
          }
        }
      }
View Full Code Here

    this.launchConfig = launchConfig;
  }

  @Override
  public CsvReporter get() {
    CsvReporter reporter = CsvReporter.forRegistry(metricRegistry).build(csvReportDirectory);
    String interval = launchConfig.getOther("metrics.scheduledreporter.interval", "30");
    reporter.start(Long.parseLong(interval), TimeUnit.SECONDS);
    return reporter;
  }
View Full Code Here

    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);
  }
View Full Code Here

TOP

Related Classes of com.codahale.metrics.CsvReporter

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.