Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 69967 invoked from network); 5 May 2008 12:14:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 May 2008 12:14:57 -0000 Received: (qmail 23609 invoked by uid 500); 5 May 2008 12:14:58 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 23545 invoked by uid 500); 5 May 2008 12:14:57 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 23534 invoked by uid 99); 5 May 2008 12:14:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 May 2008 05:14:57 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 May 2008 12:14:13 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9C1DD23889FD; Mon, 5 May 2008 05:14:27 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r653443 [2/2] - in /commons/sandbox/monitoring/trunk: ./ src/main/java/org/apache/commons/monitoring/ src/main/java/org/apache/commons/monitoring/aop/ src/main/java/org/apache/commons/monitoring/impl/monitors/ src/main/java/org/apache/commo... Date: Mon, 05 May 2008 12:14:26 -0000 To: commits@commons.apache.org From: nicolas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080505121427.9C1DD23889FD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: commons/sandbox/monitoring/trunk/src/main/resources/META-INF/monitoring.tld URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/resources/META-INF/monitoring.tld?rev=653443&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/src/main/resources/META-INF/monitoring.tld (added) +++ commons/sandbox/monitoring/trunk/src/main/resources/META-INF/monitoring.tld Mon May 5 05:14:25 2008 @@ -0,0 +1,160 @@ + + + + + 1.2 + 1.1 + monitoring + http://commons.apache.org/monitoring/tags + + start + org.apache.commons.monitoring.servlet.jsp.StartTag + org.apache.commons.monitoring.servlet.jsp.StartTagTei + empty + + id + true + true + + + scope + false + true + + + name + true + true + + + category + false + true + + + subsystem + false + true + + + + + stop + org.apache.commons.monitoring.servlet.jsp.StopTag + empty + + id + true + true + + + scope + false + true + + + + + unit + org.apache.commons.monitoring.servlet.jsp.UnitTag + empty + + unit + true + true + + + id + false + true + + + name + true + true + + + + + categories + org.apache.commons.monitoring.servlet.jsp.CategoriesTag + empty + + id + false + true + + + name + true + true + + + repository + false + true + + + + + subsystems + org.apache.commons.monitoring.servlet.jsp.SubsystemsTag + empty + + id + false + true + + + name + true + true + + + repository + false + true + + + + + statvalue + org.apache.commons.monitoring.servlet.jsp.StatValueTag + empty + + role + true + true + + + name + true + true + + + repository + false + true + + + + + + + Propchange: commons/sandbox/monitoring/trunk/src/main/resources/META-INF/monitoring.tld ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.handlers URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.handlers?rev=653443&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.handlers (added) +++ commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.handlers Mon May 5 05:14:25 2008 @@ -0,0 +1,17 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +http\://commons.apache.org/monitoring = org.apache.commons.monitoring.spring.MonitoringNamespaceHandler \ No newline at end of file Added: commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.schemas URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.schemas?rev=653443&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.schemas (added) +++ commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.schemas Mon May 5 05:14:25 2008 @@ -0,0 +1,17 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +http\://commons.apache.org/monitoring = monitoring.xsd \ No newline at end of file Added: commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd?rev=653443&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd (added) +++ commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd Mon May 5 05:14:25 2008 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file Propchange: commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd ------------------------------------------------------------------------------ svn:eol-style = native Propchange: commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml?rev=653443&r1=653442&r2=653443&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml (original) +++ commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml Mon May 5 05:14:25 2008 @@ -36,7 +36,9 @@

The application exposes it's state based on monitors. A monitor is an abstraction for any - element in the application that can expose state or resource consumption. It is identified by : + element in the application that can expose state or resource consumption. This can be a code + fragment, a web application URI, a JDBC query, some business object data, etc. It is identified + by :

  • a name that is the human readable representation of the exposed state
  • a category that matches technical layering of the application @@ -46,7 +48,6 @@

- Only the name is required, but category and subsystem is a nice way to group monitors by technical or functional criteria.

@@ -54,22 +55,24 @@

Monitors are registered in a repository, that ensure a monitor is unique for a name/category/subsytem - Key. The repository is used to retrieve existing monitors and create new ones. The default repository - implementation org.apache.commons.monitoring.impl.repositories.DefaultRepository creates new - Monitor instance when a non-existing one is requested, so you don't have to worry about monitors management. + Key. The repository is used to retrieve existing monitors and create new ones. The + default repository implementation + creates new Monitor instance when a non-existing one is requested, so you don't have to wory + about monitors management.

             Monitor monitor = repository.getMonitor( "MyService.myMethod" );
             Monitor monitor = repository.getMonitor( "SoapEndpoint.process", "soap" );
             Monitor monitor = repository.getMonitor( "/admin/userEdit.do", "struts", "user management" );
         
- You may use a custom repository by extending one of the provided implementations. You can also + You can use a custom repository by extending one of the provided implementations. You can also use the ConfigurableImplementationsRepository implementation, when you only want to configure custom implementation classes for StopWatches and Monitors.

- Monitors manage a set of StatValues that the application uses to expose state. + Monitors manage a set of StatValues that the application uses to expose state. The + monitor only identifies where the data comes from, and the statValues handle the monitored data. There is two types of values that application can use, depending on the data to be exposed :

  • a Counter is used to expose cumulative events. The value a counter maintains @@ -93,36 +96,53 @@

    In both cases, the statValues compute statistical information from what the application exposes, like - min / max / mean and standardDeviation, that in many case is more informative than the current value. + min / max / mean and standard deviation, that in many case is more informative than the current value. + Available statistical indicators are limited as a StatValue does not maintain all the individual + elements as a serie but only aggregates, to avoid memory over-consumption. +

    +

    The + default monitor implementation will create the required Gauge/Counters implementation when a + statValue is requested by the application.

    + +

    - The statValues are identified in a monitor by a role. There is predefined roles for performances and - concurrency monitoring, and any other relevant counter/gauge can be registered to a monitor. The default - org.apache.commons.monitoring.impl.CreateValuesOnDemandMonitor monitor implementation will - create the required Gauge/Counters implementation when a statValue is requested by the application. + A monitor can handle many statValues. StatValues are identified in a monitor by a role, that + describes the data beeing computed. There is predefined roles for performances, concurrency + monitoring and failures count, but any other relevant counter/gauge can be registered to a monitor.

    -            Monitor monitor = repository.getMonitor( "SoapEndpoint.process", "soap" );
    +            final static Role BYTES = new Role( "bytes", Unit.BYTES, Counter.class );
    +
    +            static Monitor monitor = repository.getMonitor( "SoapEndpoint.process" );
    +            static Counter bytes = monitor.getCounter( BYTES );
     
    -            // Process a SOAP message
    +            public void process( SOAPMessage message )
    +            {
    +                // Process a SOAP message
     
    -            // retrieve the custom Counter for the "byte" role
    -            monitor.getCounter( "bytes" ).add( SOAPMessage.getSize(), Unit.BYTES );
    +                // retrieve the custom Counter for the "byte" role
    +                bytes.add( SOAPMessage.getSize(), Unit.BYTES );
    +            }
             
    + A role can be considered as a statValue prototype. It defines : +
      +
    • The name of the statValue inside the monitor
    • +
    • The unit used for data gathered by the statValue
    • +
    • The statValue type, beeing either Counter.class or Gauge.class
    • +

    -

    Counters and Gauge knows the data type they hold : when a first value is set/added to - a StatValue, it's internal Unit is set. Any other change/addition is checked for unit to - be compatible. "compatible" means the passed values can be converted to the same primary - unit. Units are defined using the org.apache.commons.monitoring.Unit class. - Any Unit has a primary unit, and the primary unit is its own primary. Two units are - compatible if they share the same primary unit. Units are for example Unit.SECONDS - that is compatible with Unit.MILLIS as they share the same primary unit - Unit.NANOS. +

    Counters and Gauge knows the data type they hold, based on the Role used to create them : + Any data set/addition is checked for unit to be compatible. "compatible" means the passed values can be + converted to the same primary unit, "primary" beeing the finest unit available for a data type. + For example, Unit.SECONDS, is compatible with Unit.MILLIS + as they share the same primary unit Unit.NANOS.

    You can define your own units on the same basis, to ensure good usage of your monitors - and cleaner reporting. + and cleaner reporting. You can also pass data to a statValue with any compatible Unit, as + the statValue will internally handle any required conversion.

    @@ -151,10 +171,11 @@ counters. First one only computes performance of the target code, not sub-processes.

    - The default StopWatch implementation (org.apache.commons.monitoring.impl.DefaultStopWatch.java) - can optionally maintain the List of StopWatches involved in the current thread processing via the - ExecutionStack. To enable this feature, invoke DefaultStopWatch.setTraceExecution() - at application startup. + The default StopWatch implementation + can be extended to support some custom features. ExecutionStopWatch for example adds support for + a list of all stopwatches beeing used in the current thread, so that you can trace the activity if you + detect bad performances of the global process. To use a custom StopWatch class, simply setup the + repository using new DefaultRepository( MyCustomStopWatch.class ).

    Modified: commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/reporting/RendererTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/reporting/RendererTest.java?rev=653443&r1=653442&r2=653443&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/reporting/RendererTest.java (original) +++ commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/reporting/RendererTest.java Mon May 5 05:14:25 2008 @@ -91,6 +91,7 @@ { Options options = new OptionsSupport() { + @SuppressWarnings("unchecked") public Unit unitFor( Role role ) { return Unit.MICROS;