void writeSample(String metricName, Number value, String... labelsAndValuesArray) {
        SimpleTextOutputStream stream = initGaugeType(metricName);
        stream.write(metricName).write('{');
        for (int i = 0; i < labelsAndValuesArray.length; i += 2) {
            String labelValue = labelsAndValuesArray[i + 1];
            if (labelValue != null && labelValue.indexOf('"') > -1) {
                labelValue = labelValue.replace("\"", "\\\"");
            }
            stream.write(labelsAndValuesArray[i]).write("=\"").write(labelValue).write('\"');
            if (i + 2 != labelsAndValuesArray.length) {
                stream.write(',');
            }
        }
        stream.write("} ").write(value).write('\n');
    }
@Test
    public void canWriteSampleWithLabels() {
        underTest.writeSample("my-other-metric", 123, "cluster", "local");
        underTest.writeSample("my-other-metric", 456, "cluster", "local", "namespace", "my-ns");

        String actual = writeToString();

        assertTrue(actual.startsWith("# TYPE my-other-metric gauge"), "Gauge type line missing");
        assertTrue(actual.contains("my-other-metric{cluster=\"local\"} 123"), "Cluster metric line missing");
        assertTrue(actual.contains("my-other-metric{cluster=\"local\",namespace=\"my-ns\"} 456"),
                "Cluster and Namespace metric line missing");
    }