SDK for OneAPM Cloudinsight.
-
安装 Cloudinsight 探针,见文档。
-
在 pom.xml 文件中添加依赖
<dependency> <groupId>com.oneapm</groupId> <artifactId>cloudinsight-sdk</artifactId> <version>0.0.1</version> </dependency>
-
以一个小时中每隔一分钟向 Cloudinsight 探针发送一个点为例.
package com.oneapm.tps.sdk; import java.util.Random; import cloudinsight.sdk.CloudInsightStatsDClient; public class CloudInsightSDKTest { private static final Random RAND = new Random(); public static void main(String[] args) throws InterruptedException { CloudInsightStatsDClient client = new CloudInsightStatsDClient(); String metric = "sdk.java.cloudinsight"; String[] tags = new String[] {"key1:val1"}; int count = 0; while (count <= 60) { client.gauge(metric, RAND.nextDouble(), tags); count += 1; Thread.sleep(1000 * 60); } } }
-
Cloudinsight 效果图如下: