long currentTime = System.currentTimeMillis();
for (MeasurementScheduleRequest request : metrics) {
try {
if (request.getName().equals("lastSuccessfulBuildNumber") && lastSuccessfulBuild != null) {
report.addData(new MeasurementDataTrait(request, lastSuccessfulBuild.getString("number")));
} else if (request.getName().equals("lastSuccessfulBuildTime") && lastSuccessfulBuild != null) {
report.addData(new MeasurementDataTrait(request, new Date(lastSuccessfulBuild
.getLong("timestamp")).toString()));
} else if (request.getName().equals("lastSuccessfulBuildElapsedTime")
&& lastSuccessfulBuild != null) {
report.addData(new MeasurementDataNumeric(request, (currentTime - lastSuccessfulBuild
.getLong("timestamp")) / 1000d));
} else if (request.getName().equals("lastBuildNumber") && lastBuild != null) {
report.addData(new MeasurementDataTrait(request, lastBuild.getString("number")));
} else if (request.getName().equals("lastBuildTime") && lastBuild != null) {
report.addData(new MeasurementDataTrait(request, new Date(lastBuild.getLong("timestamp"))
.toString()));
} else if (request.getName().equals("lastBuildElapsedTime") && lastBuild != null) {
report.addData(new MeasurementDataNumeric(request, (currentTime - lastBuild
.getLong("timestamp")) / 1000d));
} else if (request.getName().equals("lastBuildResult") && lastBuild != null) {
report.addData(new MeasurementDataTrait(request, lastBuild.getString("result")));
} else if (request.getName().equals("healthScore") && healthReport != null) {
report.addData(new MeasurementDataNumeric(request, healthReport.getDouble("score") / 100d));
} else if (request.getName().equals("lastBuildDuration") && lastBuild != null) {
report.addData(new MeasurementDataNumeric(request, lastBuild.getDouble("duration")));
}