private static SelType sel_type_(MetricValue mv) { if (mv.getBoolValue() != null) return SelType.BOOLEAN; if (mv.getIntValue() != null) return SelType.INT; if (mv.getFltValue() != null) return SelType.FLOAT; if (mv.getStrValue() != null) return SelType.STRING; if (mv.getHistValue() != null) return SelType.HISTOGRAM; return SelType.NONE; }
final MetricValue m = tag_entry.getValue(); if (m.getBoolValue() != null) return SimpleMapEntry.create(key, m.getBoolValue()); if (m.getIntValue() != null) return SimpleMapEntry.create(key, m.getIntValue()); else if (mv.getBoolValue() != null) value = mv.getBoolValue(); else if (mv.getIntValue() != null) value = mv.getIntValue();
private MetricValue interpolate(MetricValue a, MetricValue b) { if ((a.getBoolValue() != null || a.getIntValue() != null || a.getFltValue() != null) && (b.getBoolValue() != null || b.getIntValue() != null || b.getFltValue() != null)) return MetricValue.fromDblValue(backWeight * a.value().get().doubleValue() + forwWeight * b.value().get().doubleValue()); if (a.getStrValue() != null && b.getStrValue() != null) return a; if (a.getHistValue() != null && b.getHistValue() != null) { return MetricValue.fromHistValue(Histogram.add( Histogram.multiply(a.getHistValue(), backWeight), Histogram.multiply(b.getHistValue(), forwWeight))); } // Mismatched types, return empty metric value. return MetricValue.EMPTY; } }