qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1691295 - in /qpid/java/trunk: broker-core/src/main/java/org/apache/qpid/server/model/ broker-core/src/main/java/org/apache/qpid/server/model/port/ broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servl...
Date Thu, 16 Jul 2015 00:03:39 GMT
Author: rgodfrey
Date: Thu Jul 16 00:03:38 2015
New Revision: 1691295

URL: http://svn.apache.org/r1691295
Log:
QPID-6646 : Add meta data to managed statistics

Added:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticType.java
  (with props)
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticUnit.java
  (with props)
Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/BrokerLogger.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectStatistic.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Session.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostLogger.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java
    qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java Thu
Jul 16 00:03:38 2015
@@ -42,7 +42,7 @@ public interface Binding<X extends Bindi
     @ManagedAttribute
     Map<String,Object> getArguments();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.COUNT,
label = "Matches")
     long getMatches();
 
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java Thu
Jul 16 00:03:38 2015
@@ -133,16 +133,16 @@ public interface Broker<X extends Broker
     @DerivedAttribute( persist = true )
     String getModelVersion();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Inbound")
     long getBytesIn();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Outbound")
     long getBytesOut();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Inbound")
     long getMessagesIn();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Outbound")
     long getMessagesOut();
 
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/BrokerLogger.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/BrokerLogger.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/BrokerLogger.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/BrokerLogger.java
Thu Jul 16 00:03:38 2015
@@ -28,9 +28,9 @@ public interface BrokerLogger<X extends
 
     void stopLogging();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.COUNT,
label = "Errors")
     long getErrorCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.COUNT,
label = "Warnings")
     long getWarnCount();
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectStatistic.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectStatistic.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectStatistic.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectStatistic.java
Thu Jul 16 00:03:38 2015
@@ -22,12 +22,15 @@ package org.apache.qpid.server.model;
 
 import java.lang.reflect.Method;
 
-final class ConfiguredObjectStatistic<C extends ConfiguredObject, T extends Number>
extends
+public final class ConfiguredObjectStatistic<C extends ConfiguredObject, T extends Number>
extends
                                                                                    ConfiguredObjectAttributeOrStatistic<C,T>
 {
-    ConfiguredObjectStatistic(Class<C> clazz, final Method getter)
+    private final ManagedStatistic _annotation;
+
+    ConfiguredObjectStatistic(Class<C> clazz, final Method getter, final ManagedStatistic
annotation)
     {
         super(getter);
+        _annotation = annotation;
         if(getter.getParameterTypes().length != 0)
         {
             throw new IllegalArgumentException("ManagedStatistic annotation should only be
added to no-arg getters");
@@ -38,4 +41,24 @@ final class ConfiguredObjectStatistic<C
             throw new IllegalArgumentException("ManagedStatistic annotation should only be
added to getters returning a Number type");
         }
     }
+
+    public String getDescription()
+    {
+        return _annotation.description();
+    }
+
+    public StatisticUnit getUnits()
+    {
+        return _annotation.units();
+    }
+
+    public StatisticType getStatisticType()
+    {
+        return _annotation.statisticType();
+    }
+
+    public String getLabel()
+    {
+        return _annotation.label();
+    }
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
Thu Jul 16 00:03:38 2015
@@ -664,7 +664,7 @@ public class ConfiguredObjectTypeRegistr
         {
             throw new ServerScopedRuntimeException("Can only define ManagedStatistics on
interfaces which extend " + ConfiguredObject.class.getSimpleName() + ". " + clazz.getSimpleName()
+ " does not meet these criteria.");
         }
-        ConfiguredObjectStatistic statistic = new ConfiguredObjectStatistic(clazz, m);
+        ConfiguredObjectStatistic statistic = new ConfiguredObjectStatistic(clazz, m, statAnnotation);
         if(statisticSet.contains(statistic))
         {
             statisticSet.remove(statistic);
@@ -1014,7 +1014,7 @@ public class ConfiguredObjectTypeRegistr
     }
 
 
-    protected Collection<ConfiguredObjectStatistic> getStatistics(final Class<?
extends ConfiguredObject> clazz)
+    public Collection<ConfiguredObjectStatistic> getStatistics(final Class<? extends
ConfiguredObject> clazz)
     {
         processClassIfNecessary(clazz);
         final Collection<ConfiguredObjectStatistic> statistics = (Collection) _allStatistics.get(clazz);

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java
Thu Jul 16 00:03:38 2015
@@ -87,22 +87,22 @@ public interface Connection<X extends Co
     @DerivedAttribute
     Port<?> getPort();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Inbound")
     long getBytesIn();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Outbound")
     long getBytesOut();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Inbound")
     long getMessagesIn();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Outbound")
     long getMessagesOut();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.ABSOLUTE_TIME,
label = "Last I/O time")
     long getLastIoTime();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Sessions")
     int getSessionCount();
 
     //children

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java Thu
Jul 16 00:03:38 2015
@@ -49,16 +49,16 @@ public interface Consumer<X extends Cons
     @ManagedAttribute
     String getSelector();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Outbound")
     long getBytesOut();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Outbound")
     long getMessagesOut();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES,
label = "Prefetch")
     long getUnacknowledgedBytes();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES,
label = "Prefetch")
     long getUnacknowledgedMessages();
 
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java Thu
Jul 16 00:03:38 2015
@@ -45,19 +45,19 @@ public interface Exchange<X extends Exch
     Collection<Publisher> getPublishers();
 
     // Statistics
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Bindings")
     long getBindingCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Dropped")
     long getBytesDropped();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Inbound")
     long getBytesIn();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Dropped")
     long getMessagesDropped();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Inbound")
     long getMessagesIn();
 
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java
Thu Jul 16 00:03:38 2015
@@ -29,4 +29,8 @@ import java.lang.annotation.Target;
 @Target(ElementType.METHOD)
 public @interface ManagedStatistic
 {
+    String description() default "";
+    String label() default "";
+    StatisticUnit units();
+    StatisticType statisticType();
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java Thu
Jul 16 00:03:38 2015
@@ -185,52 +185,52 @@ public interface Queue<X extends Queue<X
 
     void setNotificationListener(QueueNotificationListener listener);
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Bindings")
     int getBindingCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Consumers")
     int getConsumerCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Consumers with credit")
     int getConsumerCountWithCredit();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Delivered (Persistent)")
     long getPersistentDequeuedBytes();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Delivered (Persistent)")
     long getPersistentDequeuedMessages();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Enqueued (Persistent)")
     long getPersistentEnqueuedBytes();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Enqueued (Persistent)")
     long getPersistentEnqueuedMessages();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES,
label = "Queue Depth")
     long getQueueDepthBytes();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES,
label = "Queue Depth")
     int getQueueDepthMessages();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Delivered")
     long getTotalDequeuedBytes();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Delivered")
     long getTotalDequeuedMessages();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Enqueued")
     long getTotalEnqueuedBytes();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Enqueued")
     long getTotalEnqueuedMessages();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Prefetched")
     long getUnacknowledgedBytes();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES,
label = "Prefetched")
     long getUnacknowledgedMessages();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.ABSOLUTE_TIME,
label = "Oldest Message")
     long getOldestMessageAge();
 
     @ManagedOperation

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Session.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Session.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Session.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Session.java Thu
Jul 16 00:03:38 2015
@@ -40,19 +40,19 @@ public interface Session<X extends Sessi
     Collection<Consumer> getConsumers();
     Collection<Publisher> getPublishers();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Consumers")
     long getConsumerCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.COUNT,
label = "Transactions")
     long getLocalTransactionBegins();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Open Transactions")
     int getLocalTransactionOpen();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.COUNT,
label = "Rolled-back Transactions")
     long getLocalTransactionRollbacks();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES,
label = "Prefetched")
     long getUnacknowledgedMessages();
 
     /**
@@ -60,7 +60,7 @@ public interface Session<X extends Sessi
      *
      * @return the time this transaction started or 0 if not in a transaction
      */
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.ABSOLUTE_TIME,
label = "Last Transaction Start")
     long getTransactionStartTime();
 
     /**
@@ -68,6 +68,6 @@ public interface Session<X extends Sessi
      *
      * @return the time of the last activity or 0 if not in a transaction
      */
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.ABSOLUTE_TIME,
label = "Last Transaction Update")
     long getTransactionUpdateTime();
 }

Added: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticType.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticType.java?rev=1691295&view=auto
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticType.java
(added)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticType.java
Thu Jul 16 00:03:38 2015
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.server.model;
+
+public enum StatisticType
+{
+    CUMULATIVE,
+    POINT_IN_TIME
+}

Propchange: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticUnit.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticUnit.java?rev=1691295&view=auto
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticUnit.java
(added)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticUnit.java
Thu Jul 16 00:03:38 2015
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.server.model;
+
+public enum StatisticUnit
+{
+    COUNT("count"),
+    BYTES("byte"),
+    MESSAGES("message"),
+    ABSOLUTE_TIME("time");
+
+
+    private String _name;
+
+    StatisticUnit(final String name)
+    {
+        _name = name;
+    }
+
+    @Override
+    public String toString()
+    {
+        return _name;
+    }
+}

Propchange: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/StatisticUnit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
Thu Jul 16 00:03:38 2015
@@ -25,7 +25,6 @@ import java.security.Principal;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.UUID;
 
 import org.apache.qpid.server.message.MessageInstance;
 import org.apache.qpid.server.model.port.AmqpPort;
@@ -133,25 +132,25 @@ public interface VirtualHost<X extends V
     @ManagedAttribute( defaultValue = "[]")
     List<String> getGlobalAddressDomains();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Queues")
     long getQueueCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Exchanges")
     long getExchangeCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Connections")
     long getConnectionCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Inbound")
     long getBytesIn();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES,
label = "Outbound")
     long getBytesOut();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Inbound")
     long getMessagesIn();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES,
label = "Outbound")
     long getMessagesOut();
 
     Broker<?> getBroker();

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostLogger.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostLogger.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostLogger.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostLogger.java
Thu Jul 16 00:03:38 2015
@@ -25,9 +25,9 @@ public interface VirtualHostLogger <X ex
 {
     void stopLogging();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.COUNT,
label = "Errors")
     long getErrorCount();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.COUNT,
label = "Warnings")
     long getWarnCount();
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java
Thu Jul 16 00:03:38 2015
@@ -30,6 +30,8 @@ import org.apache.qpid.server.model.Mana
 import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.model.ManagedStatistic;
 import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.server.model.StatisticType;
+import org.apache.qpid.server.model.StatisticUnit;
 import org.apache.qpid.server.model.Transport;
 import org.apache.qpid.server.model.TrustStore;
 import org.apache.qpid.server.model.VirtualHostAlias;
@@ -118,7 +120,7 @@ public interface AmqpPort<X extends Amqp
     @ManagedAttribute( defaultValue = "${" + PORT_MAX_OPEN_CONNECTIONS + "}" )
     int getMaxOpenConnections();
 
-    @ManagedStatistic
+    @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT,
label = "Connections")
     int getConnectionCount();
 
     VirtualHostImpl getVirtualHost(String name);

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java?rev=1691295&r1=1691294&r2=1691295&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java
Thu Jul 16 00:03:38 2015
@@ -43,6 +43,7 @@ import org.apache.qpid.server.model.Conf
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.ConfiguredObjectAttribute;
 import org.apache.qpid.server.model.ConfiguredObjectOperation;
+import org.apache.qpid.server.model.ConfiguredObjectStatistic;
 import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry;
 import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.model.Model;
@@ -71,9 +72,9 @@ public class MetaDataServlet extends Abs
         response.setContentType("application/json");
         response.setStatus(HttpServletResponse.SC_OK);
 
-        Map<String,Map> classToDataMap = new TreeMap<>();
+        Map<String, Map> classToDataMap = new TreeMap<>();
 
-        for(Class<? extends ConfiguredObject> clazz : _instance.getSupportedCategories())
+        for (Class<? extends ConfiguredObject> clazz : _instance.getSupportedCategories())
         {
             classToDataMap.put(clazz.getSimpleName(), processCategory(clazz));
         }
@@ -88,32 +89,34 @@ public class MetaDataServlet extends Abs
 
     }
 
-    private Map<String,Map> processCategory(final Class<? extends ConfiguredObject>
clazz)
+    private Map<String, Map> processCategory(final Class<? extends ConfiguredObject>
clazz)
     {
         Map<String, Map> typeToDataMap = new TreeMap<>();
         ConfiguredObjectTypeRegistry typeRegistry = _instance.getTypeRegistry();
-        for(Class<? extends ConfiguredObject> type : typeRegistry.getTypeSpecialisations(clazz))
+        for (Class<? extends ConfiguredObject> type : typeRegistry.getTypeSpecialisations(clazz))
         {
             typeToDataMap.put(ConfiguredObjectTypeRegistry.getType(type), processType(type));
         }
         return typeToDataMap;
     }
 
-    private Map<String,Object> processType(final Class<? extends ConfiguredObject>
type)
+    private Map<String, Object> processType(final Class<? extends ConfiguredObject>
type)
     {
-        Map<String,Object> typeDetails = new LinkedHashMap<>();
+        Map<String, Object> typeDetails = new LinkedHashMap<>();
         typeDetails.put("attributes", processAttributes(type));
+        typeDetails.put("statistics", processStatistics(type));
+
         typeDetails.put("operations", processOperations(type));
         typeDetails.put("managedInterfaces", getManagedInterfaces(type));
         typeDetails.put("validChildTypes", getValidChildTypes(type));
         ManagedObject annotation = type.getAnnotation(ManagedObject.class);
-        if(annotation != null)
+        if (annotation != null)
         {
-            if(annotation.deprecated())
+            if (annotation.deprecated())
             {
-                typeDetails.put("deprecated",true);
+                typeDetails.put("deprecated", true);
             }
-            if(!"".equals(annotation.description() )  )
+            if (!"".equals(annotation.description()))
             {
                 typeDetails.put("description", annotation.description());
             }
@@ -124,10 +127,11 @@ public class MetaDataServlet extends Abs
     private Map<String, Collection<String>> getValidChildTypes(final Class<?
extends ConfiguredObject> type)
     {
         Map<String, Collection<String>> validChildTypes = new HashMap<>();
-        for(Class<? extends ConfiguredObject> childType : _instance.getChildTypes(ConfiguredObjectTypeRegistry.getCategory(type)))
+        for (Class<? extends ConfiguredObject> childType : _instance.getChildTypes(ConfiguredObjectTypeRegistry.getCategory(
+                type)))
         {
             Collection<String> validValues = _instance.getTypeRegistry().getValidChildTypes(type,
childType);
-            if(validValues != null)
+            if (validValues != null)
             {
                 validChildTypes.put(childType.getSimpleName(), validValues);
             }
@@ -138,64 +142,64 @@ public class MetaDataServlet extends Abs
     private Set<String> getManagedInterfaces(Class<? extends ConfiguredObject>
type)
     {
         Set<String> interfaces = new HashSet<>();
-        for(Class<?> classObject: _instance.getTypeRegistry().getManagedInterfaces(type))
+        for (Class<?> classObject : _instance.getTypeRegistry().getManagedInterfaces(type))
         {
             interfaces.add(classObject.getSimpleName());
         }
         return interfaces;
     }
 
-    private Map<String,Map> processAttributes(final Class<? extends ConfiguredObject>
type)
+    private Map<String, Map> processAttributes(final Class<? extends ConfiguredObject>
type)
     {
         Collection<ConfiguredObjectAttribute<?, ?>> attributes =
-            _instance.getTypeRegistry().getAttributeTypes(type).values();
+                _instance.getTypeRegistry().getAttributeTypes(type).values();
 
-        Map<String,Map> attributeDetails = new LinkedHashMap<>();
-        for(ConfiguredObjectAttribute<?, ?> attribute : attributes)
+        Map<String, Map> attributeDetails = new LinkedHashMap<>();
+        for (ConfiguredObjectAttribute<?, ?> attribute : attributes)
         {
-            Map<String,Object> attrDetails = new LinkedHashMap<>();
-            attrDetails.put("type",attribute.getType().getSimpleName());
-            if(!"".equals(attribute.getDescription()))
+            Map<String, Object> attrDetails = new LinkedHashMap<>();
+            attrDetails.put("type", attribute.getType().getSimpleName());
+            if (!"".equals(attribute.getDescription()))
             {
-                attrDetails.put("description",attribute.getDescription());
+                attrDetails.put("description", attribute.getDescription());
             }
-            if(attribute.isDerived())
+            if (attribute.isDerived())
             {
-                attrDetails.put("derived",attribute.isDerived());
+                attrDetails.put("derived", attribute.isDerived());
             }
-            if(attribute.isAutomated())
+            if (attribute.isAutomated())
             {
                 ConfiguredAutomatedAttribute automatedAttribute = (ConfiguredAutomatedAttribute)
attribute;
-                if(!"".equals(automatedAttribute.defaultValue()))
+                if (!"".equals(automatedAttribute.defaultValue()))
                 {
                     attrDetails.put("defaultValue", automatedAttribute.defaultValue());
                 }
-                if(automatedAttribute.isMandatory())
+                if (automatedAttribute.isMandatory())
                 {
                     attrDetails.put("mandatory", automatedAttribute.isMandatory());
                 }
-                if(automatedAttribute.isImmutable())
+                if (automatedAttribute.isImmutable())
                 {
                     attrDetails.put("immutable", automatedAttribute.isImmutable());
                 }
-                if(!(automatedAttribute.validValues()).isEmpty())
+                if (!(automatedAttribute.validValues()).isEmpty())
                 {
-                    Collection<String> validValues = ((ConfiguredAutomatedAttribute<?,?>)
attribute).validValues();
+                    Collection<String> validValues = ((ConfiguredAutomatedAttribute<?,
?>) attribute).validValues();
 
                     Collection<Object> convertedValues = new ArrayList<>(validValues.size());
-                    for(String value : validValues)
+                    for (String value : validValues)
                     {
-                        convertedValues.add(attribute.convert(value,null));
+                        convertedValues.add(attribute.convert(value, null));
                     }
                     attrDetails.put("validValues", convertedValues);
                 }
 
             }
-            if(attribute.isSecure())
+            if (attribute.isSecure())
             {
-                attrDetails.put("secure",attribute.isSecure());
+                attrDetails.put("secure", attribute.isSecure());
             }
-            if(attribute.isOversized())
+            if (attribute.isOversized())
             {
                 attrDetails.put("oversize", attribute.isOversized());
             }
@@ -204,32 +208,32 @@ public class MetaDataServlet extends Abs
         return attributeDetails;
     }
 
-    private Map<String,Map> processOperations(final Class<? extends ConfiguredObject>
type)
+    private Map<String, Map> processOperations(final Class<? extends ConfiguredObject>
type)
     {
         Collection<ConfiguredObjectOperation<?>> operations =
                 _instance.getTypeRegistry().getOperations(type).values();
 
-        Map<String,Map> attributeDetails = new LinkedHashMap<>();
-        for(ConfiguredObjectOperation<?> operation : operations)
+        Map<String, Map> attributeDetails = new LinkedHashMap<>();
+        for (ConfiguredObjectOperation<?> operation : operations)
         {
-            Map<String,Object> attrDetails = new LinkedHashMap<>();
-            attrDetails.put("name",operation.getName());
-            attrDetails.put("returnType",operation.getReturnType().getSimpleName());
-            if(!"".equals(operation.getDescription()))
+            Map<String, Object> attrDetails = new LinkedHashMap<>();
+            attrDetails.put("name", operation.getName());
+            attrDetails.put("returnType", operation.getReturnType().getSimpleName());
+            if (!"".equals(operation.getDescription()))
             {
-                attrDetails.put("description",operation.getDescription());
+                attrDetails.put("description", operation.getDescription());
             }
 
             List<OperationParameter> parameters = operation.getParameters();
-            if(!parameters.isEmpty())
+            if (!parameters.isEmpty())
             {
-                Map<String,Map> paramDetails = new LinkedHashMap<>();
-                for(OperationParameter param : parameters)
+                Map<String, Map> paramDetails = new LinkedHashMap<>();
+                for (OperationParameter param : parameters)
                 {
-                    Map<String,Object> paramAttrs = new LinkedHashMap<>();
+                    Map<String, Object> paramAttrs = new LinkedHashMap<>();
 
                     paramAttrs.put("type", param.getType().getSimpleName());
-                    if(!"".equals(param.getDefaultValue()))
+                    if (!"".equals(param.getDefaultValue()))
                     {
                         paramAttrs.put("defaultValue", param.getDefaultValue());
                     }
@@ -243,4 +247,32 @@ public class MetaDataServlet extends Abs
         }
         return attributeDetails;
     }
+
+
+    private Map<String, Map> processStatistics(final Class<? extends ConfiguredObject>
type)
+    {
+        Collection<ConfiguredObjectStatistic> statistics =
+                _instance.getTypeRegistry().getStatistics(type);
+
+        Map<String, Map> allStatisticsDetails = new LinkedHashMap<>();
+        for (ConfiguredObjectStatistic<?, ?> statistic : statistics)
+        {
+            Map<String, Object> stat = new LinkedHashMap<>();
+            stat.put("name", statistic.getName());
+            stat.put("type", statistic.getType().getSimpleName());
+            if (!"".equals(statistic.getDescription()))
+            {
+                stat.put("description", statistic.getDescription());
+            }
+            if (!"".equals(statistic.getLabel()))
+            {
+                stat.put("label", statistic.getLabel());
+            }
+
+            stat.put("units", statistic.getUnits());
+            stat.put("statisticType", statistic.getStatisticType().toString());
+            allStatisticsDetails.put(statistic.getName(), stat);
+        }
+        return allStatisticsDetails;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message