use of com.creditease.monitor.captureframework.spi.MonitorElementInstance in project uavstack by uavorg.
the class DBCPHookProxy method collectDBPoolMetrics.
@Override
protected void collectDBPoolMetrics(MonitorElement clientElem) {
if (this.datasources.size() == 0) {
return;
}
for (DataSource cp : this.datasources) {
String jdbcURL = (String) ReflectionHelper.invoke(cp.getClass().getName(), cp, "getUrl", null, null, cp.getClass().getClassLoader());
/**
* ƥ��ͻ���Ӧ��
*/
MonitorElementInstance inst = this.matchElemInstance(clientElem, jdbcURL);
if (inst == null) {
continue;
}
collectDataSourceStat(inst, cp);
}
}
use of com.creditease.monitor.captureframework.spi.MonitorElementInstance in project uavstack by uavorg.
the class MonitorServerUtil method matchClientUrl.
/**
* 匹配client url对应的MonitorElementInstance
*
* @param me
* @param jdbcURL
* @param appid
* @return
*/
public static MonitorElementInstance matchClientUrl(MonitorElement me, String jdbcURL, String appid) {
jdbcURL = MonitorServerUtil.rewriteURLForLocalHost(jdbcURL);
String clientId = MonitorServerUtil.getServerHostPort() + "#" + appid + "#" + jdbcURL;
MonitorElementInstance inst = me.getInstance(clientId);
return inst;
}
use of com.creditease.monitor.captureframework.spi.MonitorElementInstance in project uavstack by uavorg.
the class MyAppMonitorCounterHandler method doCap.
@Override
public void doCap(MonitorElement elem, CaptureContext context) {
if ("AppCustomMonitor_Counter".equals(elem.getMonitorElemId())) {
// count each URL accessing to this servlet
HttpServletRequest request = context.get(HttpServletRequest.class);
MonitorElementInstance inst = elem.getInstance(request.getRequestURI());
inst.increValue("count");
}
}
use of com.creditease.monitor.captureframework.spi.MonitorElementInstance in project uavstack by uavorg.
the class AbsDBPoolHookProxy method matchElemInstance.
/**
* matchElemInstance
*
* @param clientElem
* @param jdbcURL
* @return
*/
public MonitorElementInstance matchElemInstance(MonitorElement clientElem, String jdbcURL) {
jdbcURL = MonitorServerUtil.formatJDBCURL(jdbcURL);
/**
* 匹配客户端应用
*/
MonitorElementInstance inst = MonitorServerUtil.matchClientUrl(clientElem, jdbcURL, appid);
return inst;
}
use of com.creditease.monitor.captureframework.spi.MonitorElementInstance in project uavstack by uavorg.
the class DruidHookProxy method collectDBPoolMetrics.
@Override
protected void collectDBPoolMetrics(MonitorElement clientElem) {
Set<DruidDataSource> dsList = DruidDataSourceStatManager.getDruidDataSourceInstances();
if (dsList == null || dsList.size() == 0) {
return;
}
for (DruidDataSource ds : dsList) {
String jdbcURL = ds.getRawJdbcUrl();
/**
* 匹配客户端应用
*/
MonitorElementInstance inst = this.matchElemInstance(clientElem, jdbcURL);
if (inst == null) {
continue;
}
collectDataSourceStat(inst, ds);
}
}
Aggregations