From af1f3d30cf2e4880fa752b35296e69eb4d56c29f Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Mon, 25 Jan 2021 15:43:33 +0000 Subject: [PATCH] Update to client_java 0.10.0 and OpenMetrics. (#575) Transparently handle the UNTYPED->UNKNOWN switch for users. Change snakeyaml version to 1.23 so Java 6 works again, fixes #537. Signed-off-by: Brian Brazil --- collector/pom.xml | 4 ++-- .../src/main/java/io/prometheus/jmx/JmxCollector.java | 9 +++++++-- jmx_prometheus_httpserver/pom.xml | 2 +- jmx_prometheus_javaagent/pom.xml | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/collector/pom.xml b/collector/pom.xml index 85baa7b5..e1739b4f 100644 --- a/collector/pom.xml +++ b/collector/pom.xml @@ -18,7 +18,7 @@ io.prometheus simpleclient - 0.9.0 + 0.10.0 junit @@ -29,7 +29,7 @@ org.yaml snakeyaml - 1.26 + 1.23 diff --git a/collector/src/main/java/io/prometheus/jmx/JmxCollector.java b/collector/src/main/java/io/prometheus/jmx/JmxCollector.java index 7c5c4d4d..e49a3dc8 100644 --- a/collector/src/main/java/io/prometheus/jmx/JmxCollector.java +++ b/collector/src/main/java/io/prometheus/jmx/JmxCollector.java @@ -46,7 +46,7 @@ static class Rule { String help; boolean attrNameSnakeCase; boolean cache = false; - Type type = Type.UNTYPED; + Type type = Type.UNKNOWN; ArrayList labelNames; ArrayList labelValues; } @@ -210,7 +210,12 @@ private Config loadConfig(Map yamlConfig) throws MalformedObject rule.cache = (Boolean)yamlRule.get("cache"); } if (yamlRule.containsKey("type")) { - rule.type = Type.valueOf((String)yamlRule.get("type")); + String t = (String)yamlRule.get("type"); + // Gracefully handle switch to OM data model. + if ("UNTYPED".equals(t)) { + t = "UNKNOWN"; + } + rule.type = Type.valueOf(t); } if (yamlRule.containsKey("help")) { rule.help = (String)yamlRule.get("help"); diff --git a/jmx_prometheus_httpserver/pom.xml b/jmx_prometheus_httpserver/pom.xml index 0af0823f..e915676c 100644 --- a/jmx_prometheus_httpserver/pom.xml +++ b/jmx_prometheus_httpserver/pom.xml @@ -22,7 +22,7 @@ io.prometheus simpleclient_httpserver - 0.9.0 + 0.10.0 diff --git a/jmx_prometheus_javaagent/pom.xml b/jmx_prometheus_javaagent/pom.xml index 9e92f035..58110461 100644 --- a/jmx_prometheus_javaagent/pom.xml +++ b/jmx_prometheus_javaagent/pom.xml @@ -23,12 +23,12 @@ io.prometheus simpleclient_hotspot - 0.9.0 + 0.10.0 io.prometheus simpleclient_httpserver - 0.9.0 + 0.10.0 junit