Skip to content

Commit

Permalink
Update to client_java 0.10.0 and OpenMetrics. (#575)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
brian-brazil authored Jan 25, 2021
1 parent 3be3a59 commit af1f3d3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions collector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -29,7 +29,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
<version>1.23</version>
</dependency>
</dependencies>

Expand Down
9 changes: 7 additions & 2 deletions collector/src/main/java/io/prometheus/jmx/JmxCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static class Rule {
String help;
boolean attrNameSnakeCase;
boolean cache = false;
Type type = Type.UNTYPED;
Type type = Type.UNKNOWN;
ArrayList<String> labelNames;
ArrayList<String> labelValues;
}
Expand Down Expand Up @@ -210,7 +210,12 @@ private Config loadConfig(Map<String, Object> 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");
Expand Down
2 changes: 1 addition & 1 deletion jmx_prometheus_httpserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_httpserver</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>
</dependency>
</dependencies>

Expand Down
4 changes: 2 additions & 2 deletions jmx_prometheus_javaagent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_hotspot</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_httpserver</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down

0 comments on commit af1f3d3

Please sign in to comment.