use of backtype.storm.generated.WorkerUploadMetrics in project jstorm by alibaba.
the class MetricsUpdater method updateMetrics.
private void updateMetrics(Tuple input) {
String workerSlot = (String) input.getValueByField(TopologyMaster.FIELD_METRIC_WORKER);
WorkerUploadMetrics metrics = (WorkerUploadMetrics) input.getValueByField(TopologyMaster.FIELD_METRIC_METRICS);
topologyMetricContext.addToMemCache(workerSlot, metrics.get_allMetrics());
metricLogger.info("received metrics from:{}, size:{}", workerSlot, metrics.get_allMetrics().get_metrics_size());
}
use of backtype.storm.generated.WorkerUploadMetrics in project jstorm by alibaba.
the class JStormMetricsReporter method uploadMetricData.
public void uploadMetricData() {
if (test) {
return;
}
try {
long start = System.currentTimeMillis();
MetricInfo workerMetricInfo = MetricUtils.metricAccurateCal ? JStormMetrics.computeAllMetrics() : JStormMetrics.approximateComputeAllMetrics();
WorkerUploadMetrics upload = new WorkerUploadMetrics();
upload.set_topologyId(topologyId);
upload.set_supervisorId(host);
upload.set_port(port);
upload.set_allMetrics(workerMetricInfo);
if (workerMetricInfo.get_metrics_size() > 0) {
uploadMetricData(upload);
LOG.debug("Successfully upload worker metrics, size:{}, cost:{}", workerMetricInfo.get_metrics_size(), System.currentTimeMillis() - start);
} else {
LOG.debug("No metrics to upload.");
}
} catch (Exception e) {
LOG.error("Failed to upload worker metrics", e);
}
}
Aggregations