public static Optional<Metric> fromStringRepresentation(final String metricString) {
        if (StringUtils.isBlank(metricString)) {
            return Optional.empty();
        }
        final String[] split = metricString.split(":");
        final String functionName = split[0];
        final String fieldName = split.length > 1 ? split[1] : null;
        return Optional.of(new Metric(functionName, fieldName));
    }
@Test
    void parsesMetricsCorrectly() {
        Optional<Metric> count = Metric.fromStringRepresentation("count:stars");
        assertThat(count)
                .hasValue(new Metric("count", "stars"));

        count = Metric.fromStringRepresentation("avg:salary");
        assertThat(count)
                .hasValue(new Metric("avg", "salary"));
    }