
com.centurylink.mdw.dataaccess.reports.ProcessHotspots Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mdw-common Show documentation
Show all versions of mdw-common Show documentation
MDW is a microservices based workflow framework
package com.centurylink.mdw.dataaccess.reports;
import com.centurylink.mdw.common.service.Query;
import com.centurylink.mdw.common.service.ServiceException;
import com.centurylink.mdw.dataaccess.PreparedWhere;
import com.centurylink.mdw.model.report.Hotspot;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class ProcessHotspots extends ProcessInsights {
public List getHotspots(Query query) throws SQLException, ServiceException {
PreparedWhere where = getWhere(query);
String sql = "select avg(it.elapsed_ms) as avg_time, ai.activity_id\n" +
"from ACTIVITY_INSTANCE ai, PROCESS_INSTANCE pi, INSTANCE_TIMING it\n" +
where.getWhere() + "\ngroup by ai.activity_id\norder by avg_time desc";
try {
db.openConnection();
List hotspots = new ArrayList<>();
ResultSet rs = db.runSelect("Process hotspots ", sql, where.getParams());
while (rs.next()) {
hotspots.add(new Hotspot(rs.getString("activity_id"), rs.getLong("avg_time")));
}
return hotspots;
}
finally {
db.closeConnection();
}
}
private PreparedWhere getWhere(Query query) throws ServiceException {
StringBuilder where = new StringBuilder("where ");
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy