code: private static MetricValue opt_duration_to_metricvalue_(Optional<Duration> duration) {
          return duration
                  .map(MonitorMonitor::duration_to_metricvalue_)
                  .orElse(MetricValue.EMPTY);
      }
docs: Convert an optional duration to a metric value.
  
  The returned metric value is expressed as the duration in milliseconds.
  If the Optional is empty, an empty metric value is emitted.
  
  @param duration The duration to express.
  @return A metric value representing the duration.