Search in sources :

Example 6 with MetricTreeObject

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

the class PlatformlayerMetricsReporter method getSubtree.

static MetricTreeObject getSubtree(MetricTreeObject tree, MetricName name) {
    MetricTreeObject current = tree;
    current = current.getSubtree(name.getGroup());
    current = current.getSubtree(name.getType());
    if (name.hasScope()) {
        current = current.getSubtree(name.getScope());
    }
    current = current.getSubtree(name.getName());
    return current;
}
Also used : MetricTreeObject(org.platformlayer.metrics.MetricTreeObject)

Example 7 with MetricTreeObject

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

the class MetricClientImpl method build.

public static MetricClient build(Configuration configuration, EncryptionStore encryptionStore) throws OpsException {
    if (!configuration.lookup("metrics.report.enabled", true)) {
        return new DummyMetricClient();
    }
    // String cert = configuration.get("metrics.report.ssl.cert");
    String cert = configuration.get("metrics.tls.clientcert");
    CertificateAndKey certificateAndKey = encryptionStore.getCertificateAndKey(cert);
    String project = configuration.get("metrics.report.project");
    MetricTreeObject tags = new MetricTreeObject(null);
    Map<String, String> tagProperties = configuration.getChildProperties("metrics.report.tags.");
    copyPropertiesToTree(tagProperties, tags.getSubtree("tags"));
    return build(configuration, encryptionStore, project, tags, certificateAndKey);
}
Also used : MetricTreeObject(org.platformlayer.metrics.MetricTreeObject) CertificateAndKey(com.fathomdb.crypto.CertificateAndKey)

Example 8 with MetricTreeObject

use of org.platformlayer.metrics.MetricTreeObject 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)

Example 9 with MetricTreeObject

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

the class PlatformlayerMetricsReporter method processMeter.

@Override
public void processMeter(MetricName name, Metered meter, MetricTreeObject tree) throws IOException {
    MetricTreeObject subtree = getSubtree(tree, name);
    // final String sanitizedName = sanitizeName(name);
    subtree.addInt("count", meter.count());
    subtree.addFloat("meanRate", meter.meanRate());
    subtree.addFloat("1MinuteRate", meter.oneMinuteRate());
    subtree.addFloat("5MinuteRate", meter.fiveMinuteRate());
    subtree.addFloat("15MinuteRate", meter.fifteenMinuteRate());
}
Also used : MetricTreeObject(org.platformlayer.metrics.MetricTreeObject)

Example 10 with MetricTreeObject

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

the class PlatformlayerMetricsReporter method processCounter.

@Override
public void processCounter(MetricName name, Counter counter, MetricTreeObject tree) throws IOException {
    MetricTreeObject subtree = getSubtree(tree, name);
    subtree.addInt("count", counter.count());
}
Also used : MetricTreeObject(org.platformlayer.metrics.MetricTreeObject)

Aggregations

MetricTreeObject (org.platformlayer.metrics.MetricTreeObject)11 JsonGenerationException (com.fasterxml.jackson.core.JsonGenerationException)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 CertificateAndKey (com.fathomdb.crypto.CertificateAndKey)1 IOException (java.io.IOException)1 State (java.lang.Thread.State)1 MetricTreeBase (org.platformlayer.metrics.MetricTreeBase)1 MetricTreeArray (org.platformlayer.metrics.MetricTreeBase.MetricTreeArray)1 MetricTreeFloat (org.platformlayer.metrics.MetricTreeBase.MetricTreeFloat)1 MetricTreeInteger (org.platformlayer.metrics.MetricTreeBase.MetricTreeInteger)1 MetricTreeString (org.platformlayer.metrics.MetricTreeBase.MetricTreeString)1 MetricTreeVisitor (org.platformlayer.metrics.MetricTreeVisitor)1 MetricsSource (org.platformlayer.metrics.MetricsSource)1