use of com.yahoo.athenz.zts.ZTSClientException in project athenz by yahoo.
the class PolicyUpdater method postDomainMetrics.
public static void postDomainMetrics(ZTSClient zts) {
final String filepath = getFilePath();
File dir = new File(filepath);
File[] filenames = dir.listFiles();
if (filenames == null) {
return;
}
for (int i = 0; i < filenames.length; i++) {
String domainName = filenames[i].getName().split("_")[0];
DomainMetrics domainMetrics = null;
final String metricFile = filepath + filenames[i].getName();
try {
Path path = Paths.get(metricFile);
domainMetrics = JSON.fromBytes(Files.readAllBytes(path), DomainMetrics.class);
zts.postDomainMetrics(domainName, domainMetrics);
Files.deleteIfExists(path);
} catch (ZTSClientException | IOException ex) {
LOG.error("Unable to push domain metrics from {} - error: {}", metricFile, ex.getMessage());
}
}
}
Aggregations