commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nico...@apache.org
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 GMT
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
+                        "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
+<taglib>
+    <tlibversion>1.2</tlibversion>
+    <jspversion>1.1</jspversion>
+    <shortname>monitoring</shortname>
+    <uri>http://commons.apache.org/monitoring/tags</uri>
+    <tag>
+        <name>start</name>
+        <tagclass>org.apache.commons.monitoring.servlet.jsp.StartTag</tagclass>
+        <teiclass>org.apache.commons.monitoring.servlet.jsp.StartTagTei</teiclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>id</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>scope</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>category</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>subsystem</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <name>stop</name>
+        <tagclass>org.apache.commons.monitoring.servlet.jsp.StopTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>id</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>scope</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <name>unit</name>
+        <tagclass>org.apache.commons.monitoring.servlet.jsp.UnitTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>unit</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <name>categories</name>
+        <tagclass>org.apache.commons.monitoring.servlet.jsp.CategoriesTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>repository</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <name>subsystems</name>
+        <tagclass>org.apache.commons.monitoring.servlet.jsp.SubsystemsTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>repository</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <name>statvalue</name>
+        <tagclass>org.apache.commons.monitoring.servlet.jsp.StatValueTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>role</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>repository</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+</taglib>
+
+
+

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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<xsd:schema
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:beans="http://www.springframework.org/schema/beans"
+    targetNamespace="http://commons.apache.org/monitoring"
+    elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+    <xsd:import namespace="http://www.springframework.org/schema/beans"/>
+    <xsd:element name="auto-proxy">
+        <xsd:complexType>
+            <xsd:attribute name="pattern" type="xsd:string" />
+            <xsd:attribute name="expression" type="xsd:string" />
+            <xsd:attribute name="name-generator" type="xsd:string" use="optional" />
+            <xsd:attribute name="category" type="xsd:string" use="optional" />
+            <xsd:attribute name="subsystem" type="xsd:string" use="optional" />
+        </xsd:complexType>
+    </xsd:element>
+
+</xsd:schema>
\ 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 @@
       <subsection name="Monitors">
       <p>
         The application exposes it's state based on <b>monitors</b>. 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 :
         <ul>
             <li>a <b>name</b> that is the human readable representation
of the exposed state</li>
             <li>a <b>category</b> that matches technical layering of the
application
@@ -46,7 +48,6 @@
         </ul>
       </p>
       <p>
-
         Only the name is required, but category and subsystem is a nice way to group monitors
by technical
         or functional criteria.
       </p>
@@ -54,22 +55,24 @@
       <subsection name="Repository">
       <p>
         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 <code>org.apache.commons.monitoring.impl.repositories.DefaultRepository</code>
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
+        <a href="xref/org/apache/commons/monitoring/impl/repositories/DefaultRepository">default
repository implementation</a>
+        creates new Monitor instance when a non-existing one is requested, so you don't have
to wory
+        about monitors management.
         <pre>
             Monitor monitor = repository.getMonitor( "MyService.myMethod" );
             Monitor monitor = repository.getMonitor( "SoapEndpoint.process", "soap" );
             Monitor monitor = repository.getMonitor( "/admin/userEdit.do", "struts", "user
management" );
         </pre>
-        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 <code>ConfigurableImplementationsRepository</code> implementation,
when you only want to configure
         custom implementation classes for StopWatches and Monitors.
       </p>
       </subsection>
       <subsection name="Counters and Gauges">
       <p>
-        Monitors manage a set of <code>StatValues</code> that the application
uses to expose state.
+        Monitors manage a set of <code>StatValues</code> 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 :
         <ul>
           <li>a <b>Counter</b> is used to expose cumulative events. The
value a counter maintains
@@ -93,36 +96,53 @@
       </p>
       <p>
         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.
+      </p>
+      <p>The <a href="xref/org/apache/commons/monitoring/impl/monitors/CreateValuesOnDemandMonitor">
+        default monitor implementation</a> will create the required Gauge/Counters
implementation when a
+        statValue is requested by the application.
       </p>
+      </subsection>
+      <subsection name="Role">
       <p>
-        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
-        <code>org.apache.commons.monitoring.impl.CreateValuesOnDemandMonitor</code>
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.
         <pre>
-            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 );
+            }
         </pre>
+        A role can be considered as a statValue prototype. It defines :
+        <ul>
+            <li>The name of the statValue inside the monitor</li>
+            <li>The unit used for data gathered by the statValue</li>
+            <li>The statValue type, beeing either <code>Counter.class</code>
or <code>Gauge.class</code></li>
+        </ul>
       </p>
       </subsection>
       <subsection name="Units">
-        <p>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 <code>org.apache.commons.monitoring.Unit</code>
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 <code>Unit.SECONDS</code>
-        that is compatible with <code>Unit.MILLIS</code> as they share the same
primary unit
-        <code>Unit.NANOS</code>.
+        <p>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, <code>Unit.SECONDS</code>, is compatible with <code>Unit.MILLIS</code>
+        as they share the same primary unit <code>Unit.NANOS</code>.
         </p>
         <p>
         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.
         </p>
       </subsection>
       <subsection name="StopWatches">
@@ -151,10 +171,11 @@
         counters. First one only computes performance of the target code, not sub-processes.
       </p>
       <p>
-        The default StopWatch implementation (<code>org.apache.commons.monitoring.impl.DefaultStopWatch.java</code>)
-        can optionally maintain the List of StopWatches involved in the current thread processing
via the
-        <code>ExecutionStack</code>. To enable this feature, invoke <code>DefaultStopWatch.setTraceExecution()</code>
-        at application startup.
+        The <a href="xref/org/apache/commons/monitoring/impl/stopwatches/DefaultStopWatch">default
StopWatch implementation</a>
+        can be extended to support some custom features. <code>ExecutionStopWatch</code>
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 <code>new DefaultRepository( MyCustomStopWatch.class )</code>.
       </p>
       </subsection>
     </section>

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;



Mime
View raw message