JAMES-1868 Propose a new API for Metrics

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/43747785
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/43747785
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/43747785

Branch: refs/heads/master
Commit: 4374778551ac2ebd58f883cc141dd06fd043d64f
Parents: 9ce8f34
Author: Benoit Tellier <btell...@linagora.com>
Authored: Thu Nov 24 11:53:07 2016 +0700
Committer: Benoit Tellier <btell...@linagora.com>
Committed: Wed Nov 30 16:21:43 2016 +0700

----------------------------------------------------------------------
 server/container/metrics/metrics-api/pom.xml    | 35 ++++++++++++++++++++
 .../org/apache/james/metrics/api/Metric.java    | 28 ++++++++++++++++
 .../apache/james/metrics/api/MetricFactory.java | 26 +++++++++++++++
 server/pom.xml                                  | 20 ++++++++++-
 4 files changed, 108 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/43747785/server/container/metrics/metrics-api/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/metrics/metrics-api/pom.xml 
b/server/container/metrics/metrics-api/pom.xml
new file mode 100644
index 0000000..800e8a6
--- /dev/null
+++ b/server/container/metrics/metrics-api/pom.xml
@@ -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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <artifactId>james-server</artifactId>
+        <groupId>org.apache.james</groupId>
+        <version>3.0.0-beta6-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>james-server-metrics-api</artifactId>
+
+    <name>Apache James :: Server :: Metrics :: API</name>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/43747785/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/Metric.java
----------------------------------------------------------------------
diff --git 
a/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/Metric.java
 
b/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/Metric.java
new file mode 100644
index 0000000..b8b552f
--- /dev/null
+++ 
b/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/Metric.java
@@ -0,0 +1,28 @@
+/****************************************************************
+ * 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.james.metrics.api;
+
+public interface Metric {
+
+    void increment();
+
+    void decrement();
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/43747785/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/MetricFactory.java
----------------------------------------------------------------------
diff --git 
a/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/MetricFactory.java
 
b/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/MetricFactory.java
new file mode 100644
index 0000000..b007428
--- /dev/null
+++ 
b/server/container/metrics/metrics-api/src/main/java/org/apache/james/metrics/api/MetricFactory.java
@@ -0,0 +1,26 @@
+/****************************************************************
+ * 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.james.metrics.api;
+
+public interface MetricFactory {
+
+    Metric generate(String name);
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/43747785/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index e0de06a..b56f35d 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -56,13 +56,15 @@
         <module>karaf/features</module>
         <module>karaf/integration</module>
 
-        <module>container/guice</module>
         <module>container/cli</module>
         <module>container/core</module>
         <module>container/filesystem-api</module>
+        <module>container/guice</module>
         <module>container/jetty</module>
         <module>container/lifecycle-api</module>
         <module>container/mailbox-adapter</module>
+        <module>container/metrics/metrics-api</module>
+        <module>container/metrics/metrics-dropwizard</module>
         <module>container/spring</module>
         <module>container/util</module>
         <module>container/util-java8</module>
@@ -186,6 +188,7 @@
         <assertj-3.version>3.3.0</assertj-3.version>
         <testcontainers-version>1.0.2</testcontainers-version>
         <guavate.version>1.0.0</guavate.version>
+        <metrics.version>3.1.0</metrics.version>
     </properties>
 
     <dependencyManagement>
@@ -599,6 +602,16 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.james</groupId>
+                <artifactId>james-server-metrics-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.james</groupId>
+                <artifactId>james-server-metrics-dropwizard</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.james</groupId>
                 <artifactId>james-server-jmap</artifactId>
                 <version>${project.version}</version>
             </dependency>
@@ -1296,6 +1309,11 @@
                 <artifactId>netty</artifactId>
                 <version>${netty.version}</version>
             </dependency>
+            <dependency>
+                <groupId>io.dropwizard.metrics</groupId>
+                <artifactId>metrics-core</artifactId>
+                <version>${metrics.version}</version>
+            </dependency>
             <!-- This needed to let the bundle plugin to generate the right 
import statement -->
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to