Search in sources :

Example 1 with MetricsSource

use of org.platformlayer.metrics.MetricsSource in project platformlayer by platformlayer.

the class PlatformlayerMetricsReporter method run.

@Override
public void run() {
    long now = clock.time() / 1000;
    if (previousRun == null) {
        // TODO: Zero metrics??
        previousRun = now;
        return;
    }
    MetricTreeObject tree = new MetricTreeObject(null);
    addTimestampRange(tree, previousRun, now);
    // final long epoch = clock.time() / 1000;
    if (this.printVMMetrics) {
        printVmMetrics(tree);
    }
    addCodahaleMetrics(tree);
    for (MetricsSource reporter : registry.getAdditionalSources()) {
        reporter.addMetrics(tree);
    }
    if (metricSender.sendMetrics(tree)) {
        // TODO: Zero metrics??
        previousRun = now;
    }
}
Also used : MetricsSource(org.platformlayer.metrics.MetricsSource) MetricTreeObject(org.platformlayer.metrics.MetricTreeObject)

Aggregations

MetricTreeObject (org.platformlayer.metrics.MetricTreeObject)1 MetricsSource (org.platformlayer.metrics.MetricsSource)1