@Override
    public int compareTo(@Nonnull MetricName o) {
        if (o == null)
            return -1;

        int c = compareName(key, o.getKey());

        if (c != 0)
            return c;

        return compareTags(tags, o.getTags());
    }
@Test
    public void testCompareTo() {
        final MetricName a = MetricName.EMPTY.tagged("foo", "bar");
        final MetricName b = MetricName.EMPTY.tagged("foo", "baz");

        assertThat(a.compareTo(b)).isLessThan(0);
        assertThat(b.compareTo(a)).isGreaterThan(0);
        assertThat(b.resolve("key").compareTo(b)).isLessThan(0);
        assertThat(b.compareTo(b.resolve("key"))).isGreaterThan(0);
    }