code: public static String failMetricName(String metricName) {
          if (Strings.isNullOrEmpty(metricName)) {
              return metricName;
          }
          String[] tags = metricName.split("\\.");
          if (tags.length >= 2 && Ints.tryParse(tags[tags.length - 1]) != null) {
              tags[tags.length - 2] += "_fail";
              return String.join(".", tags);
          } else {
              return metricName + "_fail";
          }
      }
docs: For some metrics such as OpStats, Pravega generates corresponding fail metrics automatically,
  this method is called to create the name of fail metric for a given metric.
  
  Some examples of OpStats metrics and their corresponding fail metrics:
  pravega.segmentstore.bookkeeper.write_latency_ms.0
  pravega.segmentstore.bookkeeper.write_latency_ms_fail.0
  
  pravega.segmentstore.thread_pool.active_threads
  pravega.segmentstore.thread_pool.active_threads_fail
  
  The rule is, if the last segment of the metric is an integer, such as container id, the suffix "_fail"
  is appended to the preceeding segment instead of the integer itself; otherwise simply append "_fail"
  onto the given metric to get the fail metric.
  
  @param metricName the metric name for which fail metric is created
  @return the name of fail metric