Add convenience function for setting instance to the IP. · feheraron/client_java@6ddc8ad · GitHub
Skip to content

Commit 6ddc8ad

Browse files
committed
Add convenience function for setting instance to the IP.
The new pushgateway url doesn't support setting the instance to the client IP, so for those who were doing: pg.push(registry, "job", ""); they can now do: pg.push(registry, "job", PushGateway.instanceIPGroupingKey()); instead in many cases.
1 parent b9a546c commit 6ddc8ad

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

simpleclient_pushgateway/src/main/java/io/prometheus/client/exporter/PushGateway.java

Lines changed: 14 additions & 0 deletions

simpleclient_pushgateway/src/test/java/io/prometheus/client/exporter/ExamplePushGateway.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ExamplePushGateway {
1414
public static void main(String[] args) throws Exception {
1515
PushGateway pg = new PushGateway(args[0]);
1616
g.set(42);
17-
pg.push(pushRegistry, "job", "instance");
17+
pg.push(pushRegistry, "job");
1818
}
1919
}
2020

simpleclient_pushgateway/src/test/java/io/prometheus/client/exporter/PushGatewayTest.java

Lines changed: 7 additions & 0 deletions

0 commit comments

Comments
 (0)