MCPcopy Create free account
hub / github.com/OpenTSDB/opentsdb / mergeHistogramDataPoints

Method mergeHistogramDataPoints

src/core/MultiGetQuery.java:842–897  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

840 }
841
842 private void mergeHistogramDataPoints() {
843 if (histogramSpans != null) {
844 for (List<SimpleEntry<byte[], List<HistogramDataPoint>>> rows : histMap.values()) {
845 if (null == rows || rows.isEmpty()) {
846 LOG.error("Found a histogram rows list that was null or empty");
847 continue;
848 }
849
850 // for all the rows with the same salt in the timestamp order
851 for (final SimpleEntry<byte[], List<HistogramDataPoint>> row : rows) {
852 if (null == row) {
853 LOG.error("Found a histogram row item that was null");
854 continue;
855 }
856
857 HistogramSpan histSpan = null;
858 try {
859 histSpan = histogramSpans.get(row.getKey());
860 } catch (RuntimeException e) {
861 LOG.error("Failed to fetch the histogram span", e);
862 }
863
864 if (histSpan == null) {
865 histSpan = new HistogramSpan(tsdb);
866 histogramSpans.put(row.getKey(), histSpan);
867 }
868
869 if (annotMap.containsKey(row.getKey())) {
870 histSpan.getAnnotations().addAll(annotMap.get(row.getKey()));
871 annotMap.remove(row.getKey());
872 }
873
874 try {
875 histSpan.addRow(row.getKey(), row.getValue());
876 } catch (RuntimeException e) {
877 LOG.error("Exception adding row to histogram span", e);
878 }
879 } // end for
880 } // end for
881
882 histMap.clear();
883
884 for (byte[] key : annotMap.keySet()) {
885 HistogramSpan histSpan = histogramSpans.get(key);
886
887 if (histSpan == null) {
888 histSpan = new HistogramSpan(tsdb);
889 histogramSpans.put(key, histSpan);
890 }
891
892 histSpan.getAnnotations().addAll(annotMap.get(key));
893 }
894
895 annotMap.clear();
896 }
897 }
898
899 private void mergeDataPoints() {

Callers 1

mergeAndReturnResultsMethod · 0.95

Calls 11

getAnnotationsMethod · 0.95
addRowMethod · 0.95
isEmptyMethod · 0.80
errorMethod · 0.80
putMethod · 0.80
clearMethod · 0.80
valuesMethod · 0.65
removeMethod · 0.65
getMethod · 0.45
getKeyMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected