use of org.apache.storm.opentsdb.bolt.ITupleOpenTsdbDatapointMapper in project storm by apache.
the class OpenTsdbState method update.
public void update(List<TridentTuple> tridentTuples, TridentCollector collector) {
try {
List<OpenTsdbMetricDatapoint> metricDataPoints = new ArrayList<>();
for (TridentTuple tridentTuple : tridentTuples) {
for (ITupleOpenTsdbDatapointMapper tupleOpenTsdbDatapointMapper : tupleMetricPointMappers) {
metricDataPoints.add(tupleOpenTsdbDatapointMapper.getMetricPoint(tridentTuple));
}
}
final ClientResponse.Details details = openTsdbClient.writeMetricPoints(metricDataPoints);
if (details != null && (details.getFailed() > 0)) {
final String errorMsg = "Failed in writing metrics to TSDB with details: " + details;
LOG.error(errorMsg);
throw new RuntimeException(errorMsg);
}
} catch (Exception e) {
collector.reportError(e);
throw new FailedException(e);
}
}
Aggregations