From: <isp...@rh...> - 2009-08-19 16:27:57
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [4947] improve logging when a call to resourceComponent.getValues() throws an Exception</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>4947</dd> <dt>Author</dt> <dd>ispringer</dd> <dt>Date</dt> <dd>2009-08-19 11:27:50 -0500 (Wed, 19 Aug 2009)</dd> </dl> <h3>Log Message</h3> <pre>improve logging when a call to resourceComponent.getValues() throws an Exception</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcmeasurementMeasurementCollectorRunnerjava">rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcmeasurementMeasurementCollectorRunnerjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java (4946 => 4947)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java 2009-08-19 15:55:54 UTC (rev 4946) +++ rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java 2009-08-19 16:27:50 UTC (rev 4947) </span><span class="lines">@@ -29,14 +29,16 @@ </span><span class="cx"> import org.rhq.core.domain.measurement.MeasurementReport; import org.rhq.core.domain.measurement.MeasurementScheduleRequest; import org.rhq.core.domain.measurement.AvailabilityType; </span><span class="add">+import org.rhq.core.domain.resource.Resource; </span><span class="cx"> import org.rhq.core.pc.PluginContainer; import org.rhq.core.pc.inventory.InventoryManager; import org.rhq.core.pc.inventory.ResourceContainer; import org.rhq.core.pc.util.ComponentUtil; import org.rhq.core.pc.util.FacetLockType; import org.rhq.core.pluginapi.measurement.MeasurementFacet; </span><span class="add">+import org.rhq.core.util.exception.ThrowableUtil; </span><span class="cx"> </span><span class="rem">-/** </span><span class="add">+ /** </span><span class="cx"> * Executes the collection of measurements. Every call results in one new batch of measurements collected. Each batch is * limited to a single resource and the measurements that are due to be collected at that time. * </span><span class="lines">@@ -73,8 +75,8 @@ </span><span class="cx"> return report; } </span><span class="rem">- Integer id = requests.iterator().next().getResourceId(); - ResourceContainer container = im.getResourceContainer(id); </span><span class="add">+ Integer resourceId = requests.iterator().next().getResourceId(); + ResourceContainer container = im.getResourceContainer(resourceId); </span><span class="cx"> if (container.getResourceComponentState() != ResourceContainer.ResourceComponentState.STARTED || container.getAvailability() == null || container.getAvailability().getAvailabilityType() == AvailabilityType.DOWN) { </span><span class="lines">@@ -83,10 +85,10 @@ </span><span class="cx"> log.debug("Measurements not collected for inactive resource component: " + container.getResource()); } } else { </span><span class="rem">- MeasurementFacet measurementComponent = ComponentUtil.getComponent(id, MeasurementFacet.class, </span><span class="add">+ MeasurementFacet measurementComponent = ComponentUtil.getComponent(resourceId, MeasurementFacet.class, </span><span class="cx"> FacetLockType.READ, MeasurementManager.FACET_METHOD_TIMEOUT, true, true); </span><span class="rem">- getValues(measurementComponent, report, requests); </span><span class="add">+ getValues(measurementComponent, report, requests, container.getResource()); </span><span class="cx"> } this.measurementManager.reschedule(requests); </span><span class="lines">@@ -103,17 +105,23 @@ </span><span class="cx"> } private void getValues(MeasurementFacet measurementComponent, MeasurementReport report, </span><span class="rem">- Set<? extends MeasurementScheduleRequest> requests) { </span><span class="add">+ Set<? extends MeasurementScheduleRequest> requests, Resource resource) { </span><span class="cx"> try { long start = System.currentTimeMillis(); measurementComponent.getValues(report, (Set<MeasurementScheduleRequest>) requests); long duration = (System.currentTimeMillis() - start); if (duration > 2000) { </span><span class="rem">- log.info("Collection of measurements for [" + measurementComponent + "] took [" + duration + "ms]"); </span><span class="add">+ log.info("[PERF] Collection of measurements for [" + measurementComponent + "] took [" + duration + "ms]"); </span><span class="cx"> } } catch (Throwable t) { this.measurementManager.incrementFailedCollections(requests.size()); </span><span class="rem">- log.warn("Failure to collect measurement data from: " + measurementComponent, t); </span><span class="add">+ if (log.isDebugEnabled()) { + log.warn("Failure to collect measurement data for " + resource + ", requests=" + requests + + ", report.size()=" + report.getDataCount(), t); + } else { + log.warn("Failure to collect measurement data for " + resource + " - cause: " + + ThrowableUtil.getAllMessages(t)); + } </span><span class="cx"> } } </span><span class="lines">@@ -121,7 +129,7 @@ </span><span class="cx"> try { call(); } catch (Exception e) { </span><span class="rem">- log.error("Could not get measurement report", e); </span><span class="add">+ log.error("Could not get measurement report.", e); </span><span class="cx"> } } } \ No newline at end of file </span> </pre> </div> </div> </body> </html> |