etc/samples/skeleton-plugin/src/main/resources/META-INF/rhq-plugin.xml | 5 - modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/MetricsMetadataParser.java | 48 +++++----- modules/core/client-api/src/main/resources/rhq-plugin.xsd | 20 ++-- modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml | 1 4 files changed, 38 insertions(+), 36 deletions(-)
New commits: commit 727d01bb4c1bbaf96ba14f90070ea2a60c4a7a3b Author: John Mazzitelli mazz@redhat.com Date: Wed Nov 2 11:38:09 2011 -0400
[BZ 741331] change default intervals
diff --git a/etc/samples/skeleton-plugin/src/main/resources/META-INF/rhq-plugin.xml b/etc/samples/skeleton-plugin/src/main/resources/META-INF/rhq-plugin.xml index 2547af7..4f4966d 100644 --- a/etc/samples/skeleton-plugin/src/main/resources/META-INF/rhq-plugin.xml +++ b/etc/samples/skeleton-plugin/src/main/resources/META-INF/rhq-plugin.xml @@ -97,10 +97,7 @@ --> <metric property="MeasurementName" displayName="The Measurement Name" - description="Describes what this measurement is actually telling you" - defaultOn="true" - defaultInterval="300000" - category="performance" /> + description="Describes what this measurement is actually telling you" />
<!-- CHANGE: Resource configuration properties are used to configure resources themselves, as compared to the plugin diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/MetricsMetadataParser.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/MetricsMetadataParser.java index 77ecd37..c5e294f 100644 --- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/MetricsMetadataParser.java +++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/MetricsMetadataParser.java @@ -44,11 +44,12 @@ import org.rhq.core.domain.util.StringUtils; * @author Greg Hinkle */ public class MetricsMetadataParser { - private static final long MIN_1 = 1L * 60 * 1000L; - private static final long MIN_10 = 10L * MIN_1; - private static final long MIN_20 = 20L * MIN_1; - private static final long MIN_30 = 30L * MIN_1; - private static final long MIN_60 = 60L * MIN_1; + private static final long MINUTE_1 = 1L * 60 * 1000L; + private static final long MINUTE_10 = 10L * MINUTE_1; + private static final long MINUTE_20 = 20L * MINUTE_1; + private static final long MINUTE_30 = 30L * MINUTE_1; + private static final long HOUR_1 = 60L * MINUTE_1; + private static final long HOUR_24 = HOUR_1 * 24;
public static final long MINIMUM_INTERVAL = MeasurementSchedule.MINIMUM_INTERVAL;
@@ -59,24 +60,24 @@ public class MetricsMetadataParser { DataType dataType = DataType.valueOf(metricDescriptor.getDataType().toUpperCase()); DisplayType displayType = DisplayType.valueOf(metricDescriptor.getDisplayType().toUpperCase());
- long collectionInterval = MIN_30; + long collectionInterval = MINUTE_30; MeasurementUnits units = getMeasurementUnits(metricDescriptor.getUnits(), dataType);
switch (dataType) { case MEASUREMENT: { switch (resourceType.getCategory()) { case PLATFORM: { - collectionInterval = MIN_10; + collectionInterval = MINUTE_10; break; }
case SERVER: { - collectionInterval = MIN_20; + collectionInterval = MINUTE_10; break; }
case SERVICE: { - collectionInterval = MIN_30; + collectionInterval = MINUTE_20; break; } } @@ -88,12 +89,12 @@ public class MetricsMetadataParser { }
case TRAIT: { - collectionInterval = (displayType == DisplayType.SUMMARY) ? MIN_30 : MIN_60; + collectionInterval = HOUR_24; // BZ 741331 no difference between summary and detail break; }
case CALLTIME: { - collectionInterval = MIN_10; + collectionInterval = MINUTE_10; if (units != MeasurementUnits.MILLISECONDS) { throw new IllegalStateException("Units must always be set to 'milliseconds' for call-time metrics."); } @@ -110,10 +111,10 @@ public class MetricsMetadataParser { (metricDescriptor.getDefaultInterval() == null) ? collectionInterval : metricDescriptor .getDefaultInterval().longValue());
- definition = new MeasurementDefinition(metricDescriptor.getProperty(), MeasurementCategory - .valueOf(metricDescriptor.getCategory().toUpperCase()), getMeasurementUnits(metricDescriptor.getUnits(), - dataType), dataType, NumericType.valueOf(metricDescriptor.getMeasurementType().toUpperCase()), - metricDescriptor.isDefaultOn(), collectionInterval, displayType); + definition = new MeasurementDefinition(metricDescriptor.getProperty(), + MeasurementCategory.valueOf(metricDescriptor.getCategory().toUpperCase()), getMeasurementUnits( + metricDescriptor.getUnits(), dataType), dataType, NumericType.valueOf(metricDescriptor + .getMeasurementType().toUpperCase()), metricDescriptor.isDefaultOn(), collectionInterval, displayType);
if (metricDescriptor.getDisplayName() != null) { definition.setDisplayName(metricDescriptor.getDisplayName()); @@ -129,19 +130,22 @@ public class MetricsMetadataParser { definition.setDestinationType(metricDescriptor.getDestinationType());
// Make sure that all summary properties are on by default. - // BZ 741331 - we no longer want to imply any metric should be on by default - // let the plugin writer tell us explicitly if it should be on by default - // if (definition.getDisplayType() == DisplayType.SUMMARY) { - // definition.setDefaultOn(true); - // } + // It is assumed that if a plugin developer marks a metric as "summary" (which + // shows the metric's graph within the graph page of the UI) then he doesn't want + // to show an empty graph by default. Therefore, a summary metric will always be + // enabled by default. You can't say a metric is a "summary" metric but with + // defaultOn="false". The defaultOn will be overridden here and will be set to true. + if (definition.getDisplayType() == DisplayType.SUMMARY) { + definition.setDefaultOn(true); + }
if ((definition.getNumericType() == NumericType.TRENDSUP) || (definition.getNumericType() == NumericType.TRENDSDOWN)) { ArrayList<MeasurementDefinition> definitions = new ArrayList<MeasurementDefinition>(); MeasurementDefinition perMinuteMetric = new MeasurementDefinition(definition);
- // Default to applying defaultOn, SUMMARY type, etc. to the per-minute version of the metric, - // so only the per-minute, and not the raw, is enabled by default. + // Disable the raw metric since that is usually what the user will want. Typically, + // the user will only care about the per-minute metric. definition.setDisplayType(DisplayType.DETAIL); definition.setDefaultOn(false);
diff --git a/modules/core/client-api/src/main/resources/rhq-plugin.xsd b/modules/core/client-api/src/main/resources/rhq-plugin.xsd index 927d0d7..df31a44 100644 --- a/modules/core/client-api/src/main/resources/rhq-plugin.xsd +++ b/modules/core/client-api/src/main/resources/rhq-plugin.xsd @@ -202,16 +202,16 @@ xs:annotation xs:documentation The default collection interval, in milliseconds. The metric is not necessarily - enabled by default - see the defaultOn attribute for that. The minimum allowed - value is 30000 (30 seconds). If unspecified, the default collection interval is - set according to the Resource category, metric data type, and metric display - type, as follows: + enabled by default - see the defaultOn and displayType attributes for that. + The minimum allowed value is 30000 (30 seconds). + If unspecified, the default collection interval is set according to the + resource type category, metric data type, and metric display type, as follows:
- platform numeric metrics: summary - 1m, detail - 2m - server numeric metrics: summary - 5m, detail - 10m - service numeric metrics: summary - 10m, detail - 20m - traits: summary - 10m, detail - 30m - call-time metrics: 1m + Platform numeric metrics: summary - 10m, detail - 20m + Server numeric metrics: summary - 10m, detail - 20m + Service numeric metrics: summary - 20m, detail - 40m + All Traits: summary and detail - 24 hours + Calltime metrics: 10m </xs:documentation> </xs:annotation> xs:simpleType @@ -225,6 +225,8 @@ xs:documentation If true, this metric will get collected as soon as possible. If false, a user must explicitly tell the plugin to collect this metric. + This is only used for metrics with a displayType of "detail". All + "summary" metrics are enabled by default, regardless of this value. </xs:documentation> </xs:annotation> </xs:attribute> diff --git a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml index 69cbf8a..ee83f0c 100644 --- a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml @@ -196,7 +196,6 @@ displayName="Agent Home Directory" dataType="trait" displayType="detail" - defaultInterval="86400000" description="The directory where the agent is installed" />
<metric property="NumberAgentRestarts"
rhq-commits@lists.fedorahosted.org