MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / call

Method call

src/tsd/PutDataPointRpc.java:620–674  ·  view source on GitHub ↗
(final ArrayList<Boolean> results)

Source from the content-addressed store, hash-verified

618 }
619
620 @Override
621 public Object call(final ArrayList<Boolean> results) {
622 if (sending_response.get()) {
623 if (LOG.isDebugEnabled()) {
624 LOG.debug("Put data point call " + query + " was marked as timedout");
625 }
626 return null;
627 } else {
628 sending_response.set(true);
629 if (timeout != null) {
630 timeout.cancel();
631 }
632 }
633 int good_writes = 0;
634 int failed_writes = 0;
635 for (final boolean result : results) {
636 if (result) {
637 ++good_writes;
638 } else {
639 ++failed_writes;
640 }
641 }
642
643 final int failures = dps.size() - queued;
644 if (!show_summary && !show_details) {
645 if (failures + failed_writes > 0) {
646 query.sendReply(HttpResponseStatus.BAD_REQUEST,
647 query.serializer().formatErrorV1(
648 new BadRequestException(HttpResponseStatus.BAD_REQUEST,
649 "One or more data points had errors",
650 "Please see the TSD logs or append \"details\" to the put request")));
651 } else {
652 query.sendReply(HttpResponseStatus.NO_CONTENT, "".getBytes());
653 }
654 } else {
655 final HashMap<String, Object> summary = new HashMap<String, Object>();
656 if (sync_timeout > 0) {
657 summary.put("timeouts", 0);
658 }
659 summary.put("success", results.isEmpty() ? queued : good_writes);
660 summary.put("failed", failures + failed_writes);
661 if (show_details) {
662 summary.put("errors", details);
663 }
664
665 if (failures > 0) {
666 query.sendReply(HttpResponseStatus.BAD_REQUEST,
667 query.serializer().formatPutV1(summary));
668 } else {
669 query.sendReply(query.serializer().formatPutV1(summary));
670 }
671 }
672
673 return null;
674 }
675 @Override
676 public String toString() {
677 return "put data point serialization callback";

Callers

nothing calls this directly

Calls 10

setMethod · 0.80
sendReplyMethod · 0.80
formatErrorV1Method · 0.80
serializerMethod · 0.80
putMethod · 0.80
isEmptyMethod · 0.80
sizeMethod · 0.65
getMethod · 0.45
getBytesMethod · 0.45
formatPutV1Method · 0.45

Tested by

no test coverage detected