code: private static double scale(MetricDto metric, double value) {
      if (metric.getDecimalScale() == null) {
        return value;
      }
      BigDecimal bd = BigDecimal.valueOf(value);
      return bd.setScale(metric.getDecimalScale(), RoundingMode.HALF_UP).doubleValue();
    }
docs: Round a measure value by applying the scale defined on the metric.
  Example: scale(0.1234) returns 0.12 if metric scale is 2