This is an automated email from the ASF dual-hosted git repository. mmerli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push: new 50beaca Fixed missing '"' sign in system metrics for Prometheus (#1209) 50beaca is described below commit 50beacae60cb6ec9384c1fa2b39c4ca3cb7cbe80 Author: Matteo Merli <mme...@apache.org> AuthorDate: Fri Feb 9 12:30:02 2018 -0800 Fixed missing '"' sign in system metrics for Prometheus (#1209) --- .../pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java | 7 +++---- .../java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java index 26118c8..e7bcda1 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java @@ -85,14 +85,13 @@ public class PrometheusMetricsGenerator { for (int i = 0; i < metricFamily.samples.size(); i++) { Sample sample = metricFamily.samples.get(i); stream.write(sample.name); - stream.write("{cluster=\"").write(cluster).write("\","); + stream.write("{cluster=\"").write(cluster).write('"'); for (int j = 0; j < sample.labelNames.size(); j++) { + stream.write(", "); stream.write(sample.labelNames.get(j)); stream.write("=\""); stream.write(sample.labelValues.get(j)); - if (j != sample.labelNames.size() - 1) { - stream.write("\","); - } + stream.write('"'); } stream.write("} "); diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java index be19b57..8aa6fdc 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java @@ -90,6 +90,11 @@ public class PrometheusMetricsTest extends BrokerTestBase { assertEquals(cm.get(1).tags.get("topic"), "persistent://my-property/use/my-ns/my-topic1"); assertEquals(cm.get(1).tags.get("namespace"), "my-property/use/my-ns"); + cm = (List<Metric>) metrics.get("topic_load_times_count"); + assertEquals(cm.size(), 1); + assertEquals(cm.get(0).value, 2.0); + assertEquals(cm.get(0).tags.get("cluster"), "test"); + p1.close(); p2.close(); } -- To stop receiving notification emails like this one, please contact mme...@apache.org.