use of org.glassfish.external.probe.provider.annotations.ProbeListener in project Payara by payara.
the class FlashlightProbeClientMediator method handleListenerAnnotations.
/**
* Pick out all methods in the listener with the correct annotation, look up
* the referenced Probe and return a list of all such pairs. Validate that
* the methods really do matchup properly.
*
* @throws RuntimeException if there is any serious problem.
* @param listenerClass
* @return
*/
private List<MethodProbe> handleListenerAnnotations(Class listenerClass, String invokerId) {
List<MethodProbe> mp = new LinkedList<MethodProbe>();
for (Method method : listenerClass.getMethods()) {
ProbeListener probeAnn = method.getAnnotation(ProbeListener.class);
if (probeAnn == null)
continue;
String probeString = probeAnn.value();
if (probeString == null)
continue;
if (invokerId != null) {
String[] strArr = probeString.split(":");
probeString = strArr[0] + ":" + strArr[1] + ":" + strArr[2] + invokerId + ":" + strArr[3];
}
FlashlightProbe probe = probeRegistry.getProbe(probeString);
if (probe == null) {
String errStr = localStrings.getLocalString("probeNotRegistered", "Probe is not registered: {0}", probeString);
throw new RuntimeException(errStr);
}
mp.add(new MethodProbe(method, probe));
}
return mp;
}
use of org.glassfish.external.probe.provider.annotations.ProbeListener in project Payara by payara.
the class ConnectorConnPoolStatsProvider method connectionsFreedEvent.
/**
* Connections freed event
* @param poolName
* @param count number of connections freed to the pool
*/
@ProbeListener(JCA_PROBE_LISTENER + "connectionsFreedEvent")
public void connectionsFreedEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("count") int count) {
// handle the connections freed event
PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
if (this.poolInfo.equals(poolInfo)) {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Connections Freed event received - poolName = " + poolName);
logger.finest("numConnUsed =" + numConnUsed.getCurrent() + " numConnFree=" + numConnFree.getCurrent() + " Number of connections freed =" + count);
}
// set numConnFree to the count value
synchronized (numConnFree) {
numConnFree.setCurrent(count);
}
}
}
use of org.glassfish.external.probe.provider.annotations.ProbeListener in project Payara by payara.
the class JdbcStatsProvider method traceSQLEvent.
/**
* Whenever a sql statement that is traced is to be cache for monitoring
* purpose, the SQLTrace object is created for the specified sql and
* updated in the SQLTraceCache. This is used to update the
* frequently used and slowest sql queries.
*
* @param poolName
* @param appName
* @param sql
* @param moduleName
* @param executionTime
*/
@ProbeListener(JdbcRAConstants.SQL_TRACING_DOTTED_NAME + JdbcRAConstants.TRACE_SQL)
public void traceSQLEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("sql") String sql, @ProbeParam("executionTime") long executionTime) {
PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
if (this.poolInfo.equals(poolInfo)) {
if (freqSqlTraceCache != null) {
if (sql != null) {
SQLTrace cacheObj = new SQLTrace(sql, 1, System.currentTimeMillis());
freqSqlTraceCache.checkAndUpdateCache(cacheObj);
}
}
// the cache
if (slowSqlTraceCache != null && sql != null) {
SQLTrace cacheObj = new SlowSqlTrace(sql, 1, System.currentTimeMillis(), executionTime);
slowSqlTraceCache.checkAndUpdateCache(cacheObj);
}
}
}
use of org.glassfish.external.probe.provider.annotations.ProbeListener in project Payara by payara.
the class JdbcConnPoolStatsProvider method connectionRequestServedEvent.
/**
* Event that a connection request is served in timeTakenInMillis.
*
* @param poolName
* @param timeTakenInMillis
*/
@ProbeListener(JDBC_PROBE_LISTENER + "connectionRequestServedEvent")
public void connectionRequestServedEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("timeTakenInMillis") long timeTakenInMillis) {
PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
if (this.poolInfo.equals(poolInfo)) {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Connection request served event received - " + "poolName = " + poolName);
}
connRequestWaitTime.setCurrent(timeTakenInMillis);
totalConnRequestWaitTime.increment(timeTakenInMillis);
}
}
use of org.glassfish.external.probe.provider.annotations.ProbeListener in project Payara by payara.
the class WebServiceStatsProvider method riDeploy.
// sun-jaxws.xml deployment
@ProbeListener("glassfish:webservices:deployment-ri:deploy")
public synchronized void riDeploy(@ProbeParam("adapter") ServletAdapter adapter) {
String contextPath = adapter.getServletContext().getContextPath();
String path = contextPath + adapter.getValidPath();
DeployedEndpointData data = endpoints.get(path);
if (data == null) {
data = new DeployedEndpointData(path, adapter);
endpoints.put(path, data);
}
List<DeployedEndpointData> ri = riEndpoints.get(contextPath);
if (ri == null) {
ri = new ArrayList<DeployedEndpointData>();
riEndpoints.put(contextPath, ri);
}
ri.add(data);
}
Aggregations