druid 如何将监控数据收集起来,有切入点吗

krcsximq  于 4个月前  发布在  Druid
关注(0)|答案(2)|浏览(70)

我想将druid采集的数据每隔一分钟收集起来,存放到自己公司系统中提供分析和告警。请问有这相关文档吗?或者主要涉及类

sz81bmfz

sz81bmfz1#

我自己找到了一个地方,主要代码如下:
public class DruidMonitorService {
public static final String SQL_QUERY_DETAIL = "/sql.json?orderBy=SQL&orderType=desc&page=1&perPageCount=1000000&";
public static final String REST_ALL = "/reset-all.json";

private DruidStatService service;

private static DruidMonitorService instance = new DruidMonitorService();

public static DruidMonitorService getInstance() {
    return instance;
}

private DruidMonitorService() {
    service = DruidStatService.getInstance();
}

/**
 * 上报并清空
 *
 * @return
 */
public String reportAndClear() {
    String result = service.service(SQL_QUERY_DETAIL);
    DruidStatService.getInstance().service(REST_ALL);
    return result;
}

}

相关问题