use of org.apache.helix.model.HealthStat in project helix by apache.
the class ParticipantHealthReportCollectorImpl method transmitHealthReports.
@Override
public synchronized void transmitHealthReports() {
synchronized (_healthReportProviderList) {
for (HealthReportProvider provider : _healthReportProviderList) {
try {
Map<String, String> report = provider.getRecentHealthReport();
Map<String, Map<String, String>> partitionReport = provider.getRecentPartitionHealthReport();
ZNRecord record = new ZNRecord(provider.getReportName());
if (report != null) {
record.setSimpleFields(report);
}
if (partitionReport != null) {
record.setMapFields(partitionReport);
}
record.setSimpleField(HealthStat.TIMESTAMP_NAME, "" + System.currentTimeMillis());
HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
Builder keyBuilder = accessor.keyBuilder();
if (!accessor.setProperty(keyBuilder.healthReport(_instanceName, record.getId()), new HealthStat(record))) {
LOG.error("Failed to persist health report to zk!");
}
provider.resetStats();
} catch (Exception e) {
LOG.error("fail to transmit health report", e);
}
}
}
}
use of org.apache.helix.model.HealthStat in project helix by apache.
the class ParticipantHealthReportCollectorImpl method reportHealthReportMessage.
@Override
public void reportHealthReportMessage(ZNRecord healthCheckInfoUpdate) {
HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
Builder keyBuilder = accessor.keyBuilder();
if (!accessor.setProperty(keyBuilder.healthReport(_instanceName, healthCheckInfoUpdate.getId()), new HealthStat(healthCheckInfoUpdate))) {
LOG.error("Failed to persist health report to zk!");
}
}
Aggregations