StringBuilder builder = new StringBuilder("\nCoverage summary\n"); int routes = managedCamelContext.getTotalRoutes(); long contextExchangesTotal = managedCamelContext.getExchangesTotal(); if (managedRoute.getExchangesTotal() == 0) { uncoveredRoutes.add(route.getId()); long routeCoveragePercentage = Math.round((double) managedRoute.getExchangesTotal() / contextExchangesTotal * 100); routesSummary.append("\t\tRoute ").append(route.getId()).append(" total: ").append(managedRoute.getExchangesTotal()).append(" (").append(routeCoveragePercentage).append("%)\n"); if (processors != null) { for (ManagedProcessorMBean managedProcessor : processors) { String processorId = managedProcessor.getProcessorId(); long processorExchangesTotal = managedProcessor.getExchangesTotal(); long processorCoveragePercentage = Math.round((double) processorExchangesTotal / contextExchangesTotal * 100); routesSummary.append("\t\t\tProcessor ").append(processorId).append(" total: ").append(processorExchangesTotal).append(" (").append(processorCoveragePercentage).append("%)\n"); builder.append("\t\tCamelContext (").append(managedCamelContext.getCamelId()).append(") total: ").append(contextExchangesTotal).append("\n");
public String getCamelUptime() throws Exception { return proxy.getUptime(); } }
public String getCamelVersion() throws Exception { return proxy.getCamelVersion(); }
RouteDetails(ManagedRouteMBean managedRoute) { try { this.deltaProcessingTime = managedRoute.getDeltaProcessingTime(); this.exchangesInflight = managedRoute.getExchangesInflight(); this.exchangesTotal = managedRoute.getExchangesTotal(); this.externalRedeliveries = managedRoute.getExternalRedeliveries(); this.failuresHandled = managedRoute.getFailuresHandled(); this.firstExchangeCompletedExchangeId = managedRoute.getFirstExchangeCompletedExchangeId(); this.firstExchangeCompletedTimestamp = managedRoute.getFirstExchangeCompletedTimestamp(); this.firstExchangeFailureExchangeId = managedRoute.getFirstExchangeFailureExchangeId(); this.firstExchangeFailureTimestamp = managedRoute.getFirstExchangeFailureTimestamp(); this.lastExchangeCompletedExchangeId = managedRoute.getLastExchangeCompletedExchangeId(); this.lastExchangeCompletedTimestamp = managedRoute.getLastExchangeCompletedTimestamp(); this.lastExchangeFailureExchangeId = managedRoute.getLastExchangeFailureExchangeId(); this.lastExchangeFailureTimestamp = managedRoute.getLastExchangeFailureTimestamp(); this.lastProcessingTime = managedRoute.getLastProcessingTime(); this.load01 = managedRoute.getLoad01(); this.load05 = managedRoute.getLoad05(); this.load15 = managedRoute.getLoad15(); this.maxProcessingTime = managedRoute.getMaxProcessingTime(); this.meanProcessingTime = managedRoute.getMeanProcessingTime(); this.minProcessingTime = managedRoute.getMinProcessingTime(); this.oldestInflightDuration = managedRoute.getOldestInflightDuration(); this.oldestInflightExchangeId = managedRoute.getOldestInflightExchangeId(); this.redeliveries = managedRoute.getRedeliveries(); this.totalProcessingTime = managedRoute.getTotalProcessingTime(); this.lastError = managedRoute.getLastError(); this.hasRouteController = managedRoute.getHasRouteController(); } catch (Exception e) {
public RouteStats getCurrentStats(String routeId, CamelContext camelContext) { RouteStats routeStats = createRouteStats(routeId); try { routeStats.setModelUuid(getModelUUID(camelContext)); ManagedRouteMBean managedRoute = camelContext.getManagedRoute(routeId, ManagedRouteMBean.class); routeStats.setCompleted(managedRoute.getExchangesCompleted()); routeStats.setFailed(managedRoute.getExchangesFailed()); routeStats.setFailuresHandled(managedRoute.getFailuresHandled()); routeStats.setLastProcessingTime(managedRoute.getLastProcessingTime()); return routeStats; } catch (Exception e) { throw new CamelStatisticsAccessException("Failed to get statistics for route " + routeId, e); } }
@Override public List<Map<String, String>> getCamelContexts() throws Exception { List<Map<String, String>> answer = new ArrayList<>(); List<CamelContext> camelContexts = getLocalCamelContexts(); for (CamelContext camelContext : camelContexts) { Map<String, String> row = new LinkedHashMap<>(); row.put("name", camelContext.getName()); row.put("state", camelContext.getStatus().name()); row.put("uptime", camelContext.getUptime()); if (camelContext.getManagedCamelContext() != null) { row.put("exchangesTotal", "" + camelContext.getManagedCamelContext().getExchangesTotal()); row.put("exchangesInflight", "" + camelContext.getManagedCamelContext().getExchangesInflight()); row.put("exchangesFailed", "" + camelContext.getManagedCamelContext().getExchangesFailed()); } else { row.put("exchangesTotal", "0"); row.put("exchangesInflight", "0"); row.put("exchangesFailed", "0"); } answer.add(row); } return answer; }
logCoverageSummary(managedCamelContext); String xml = managedCamelContext.dumpRoutesCoverageAsXml(); String combined = "<camelRouteCoverage>\n" + gatherTestDetailsAsXml() + xml + "\n</camelRouteCoverage>";
public long reportThrottler() throws Exception { // use the JMX management API to get the mbean for the throttler EIP with the id orderThrottler ManagedThrottlerMBean throttler = camelContext.getManagedProcessor("orderThrottler", ManagedThrottlerMBean.class); // get the number of current throttled messages return throttler.getExchangesInflight(); } }
@ManagedAttribute public Long getResetTimestamp() { final Date resetTimestamp = camelContext.getManagedCamelContext().getResetTimestamp(); return resetTimestamp == null ? null : resetTimestamp.getTime(); }
private void resetRoute(String id) { try { ManagedRouteMBean managedRouteMBean = camelContext.getManagedRoute(id, ManagedRouteMBean.class); if (managedRouteMBean != null) { managedRouteMBean.reset(true); } } catch (Exception e) { throw new RuntimeCamelException(e); } }
@ManagedAttribute public Long getLastExchangeCompletedTimestamp() { final Date timestamp = camelContext.getManagedCamelContext() .getLastExchangeCompletedTimestamp(); return timestamp == null ? null : timestamp.getTime(); }
@ManagedAttribute public Long getLastExchangeFailureTimestamp() { final Date timestamp = camelContext.getManagedCamelContext() .getLastExchangeFailureTimestamp(); return timestamp == null ? null : timestamp.getTime(); }
@ManagedAttribute public Long getStartTimestamp() { return camelContext.getManagedCamelContext().getStartTimestamp().getTime(); }
public RouteDetails(ManagedRouteMBean managedRoute) { try { this.deltaProcessingTime = managedRoute.getDeltaProcessingTime(); this.exchangesInflight = managedRoute.getExchangesInflight(); this.exchangesTotal = managedRoute.getExchangesTotal(); this.externalRedeliveries = managedRoute.getExternalRedeliveries(); this.failuresHandled = managedRoute.getFailuresHandled(); this.firstExchangeCompletedExchangeId = managedRoute.getFirstExchangeCompletedExchangeId(); this.firstExchangeCompletedTimestamp = managedRoute.getFirstExchangeCompletedTimestamp(); this.firstExchangeFailureExchangeId = managedRoute.getFirstExchangeFailureExchangeId(); this.firstExchangeFailureTimestamp = managedRoute.getFirstExchangeFailureTimestamp(); this.lastExchangeCompletedExchangeId = managedRoute.getLastExchangeCompletedExchangeId(); this.lastExchangeCompletedTimestamp = managedRoute.getLastExchangeCompletedTimestamp(); this.lastExchangeFailureExchangeId = managedRoute.getLastExchangeFailureExchangeId(); this.lastExchangeFailureTimestamp = managedRoute.getLastExchangeFailureTimestamp(); this.lastProcessingTime = managedRoute.getLastProcessingTime(); this.load01 = managedRoute.getLoad01(); this.load05 = managedRoute.getLoad05(); this.load15 = managedRoute.getLoad15(); this.maxProcessingTime = managedRoute.getMaxProcessingTime(); this.meanProcessingTime = managedRoute.getMeanProcessingTime(); this.minProcessingTime = managedRoute.getMinProcessingTime(); this.oldestInflightDuration = managedRoute.getOldestInflightDuration(); this.oldestInflightExchangeId = managedRoute.getOldestInflightExchangeId(); this.redeliveries = managedRoute.getRedeliveries(); this.totalProcessingTime = managedRoute.getTotalProcessingTime(); this.lastError = managedRoute.getLastError(); this.hasRouteController = managedRoute.getHasRouteController(); } catch (Exception e) {