继续学习prometheus,上一节演示了用http方式使用curl向pushgateway发送数据,本节将研究如何利用client jar包,以java代码的方式写入数据。
一、依赖的jar包
1 <dependency> 2 <groupId>io.prometheus</groupId> 3 <artifactId>simpleclient</artifactId> 4 <version>0.9.0</version> 5 </dependency> 6 7 <dependency> 8 <groupId>io.prometheus</groupId> 9 <artifactId>simpleclient_pushgateway</artifactId> 10 <version>0.9.0</version> 11 </dependency>