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;
}
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);
}
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;
}
}
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());
}
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());
}
Aggregations