@VisibleForTesting
  @SuppressWarnings("nullness") // ok to have nullable elements on stream
  static String renderName(String prefix, MetricResult<?> metricResult) {
    MetricKey key = metricResult.getKey();
    MetricName name = key.metricName();
    String step = key.stepName();
    return Streams.concat(
            Stream.of(prefix),
            Stream.of(stripSuffix(normalizePart(step))),
            Stream.of(name.getNamespace(), name.getName()).map(SparkBeamMetric::normalizePart))
        .filter(not(Strings::isNullOrEmpty))
        .collect(Collectors.joining("."));
  }
@Test
  public void testRenderNameWithPrefix() {
    MetricResult<Object> metricResult =
        MetricResult.create(
            MetricKey.create(
                "myStep.one.two(three)", MetricName.named("myNameSpace//", "myName()")),
            123,
            456);
    String renderedName = SparkBeamMetric.renderName("prefix", metricResult);
    assertThat(
        "Metric name was not rendered correctly",
        renderedName,
        equalTo("prefix.myStep_one_two_three.myNameSpace__.myName__"));
  }