use of com.yahoo.metrics.MetricSnapshot in project vespa by vespa-engine.
the class StatusResponse method render.
@Override
public void render(OutputStream stream) throws IOException {
XMLWriter writer = new XMLWriter(new OutputStreamWriter(stream));
writer.openTag("status");
if (verbosity >= 2) {
writer.attribute(new Utf8String("description"), "Metrics since start");
}
if (snapshotTime == 0) {
MetricSnapshot snapshot = (new MetricSnapshot("Total metrics from start until current time", 0, manager.getActiveMetrics().getMetrics(), false));
manager.getTotalMetricSnapshot().addToSnapshot(snapshot, (int) (System.currentTimeMillis() / 1000), false);
snapshot.printXml(manager, "", verbosity, writer);
} else {
try {
manager.getMetricSnapshotSet(snapshotTime).getSnapshot().printXml(manager, "", verbosity, writer);
} catch (Exception e) {
writer.openTag("error");
writer.attribute(new Utf8String("details"), "No metric snapshot with period " + snapshotTime + " was found. Legal snapshot periods are: " + manager.getSnapshotPeriods());
writer.closeTag();
}
}
writer.closeTag();
writer.flush();
}
Aggregations