JAMES-1868 Add support for DropWizard metrics in Guice

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

Branch: refs/heads/master
Commit: 69769e044eafb07ea43ba5876e3b242d67ec1fa0
Parents: 197cc76
Author: Benoit Tellier <btell...@linagora.com>
Authored: Thu Nov 24 11:57:44 2016 +0700
Committer: Benoit Tellier <btell...@linagora.com>
Committed: Wed Nov 30 16:29:36 2016 +0700

----------------------------------------------------------------------
 server/container/guice/guice-common/pom.xml     |  8 +++++
 .../james/modules/CommonServicesModule.java     |  2 ++
 .../modules/server/DropWizardMetricsModule.java | 36 ++++++++++++++++++++
 3 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/69769e04/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml 
b/server/container/guice/guice-common/pom.xml
index 983b637..9fb7eb8 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -192,6 +192,14 @@
                     <artifactId>james-server-mailetcontainer-camel</artifactId>
                 </dependency>
                 <dependency>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>james-server-metrics-api</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>james-server-metrics-dropwizard</artifactId>
+                </dependency>
+                <dependency>
                     <groupId>${project.groupId}</groupId>
                     <artifactId>james-server-protocols-imap4</artifactId>
                 </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/69769e04/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
index df0d349..60d1f41 100644
--- 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
@@ -33,6 +33,7 @@ import 
org.apache.james.filesystem.api.JamesDirectoriesProvider;
 import org.apache.james.modules.server.AsyncTasksExecutorModule;
 import org.apache.james.modules.server.ConfigurationProviderModule;
 import org.apache.james.modules.server.DNSServiceModule;
+import org.apache.james.modules.server.DropWizardMetricsModule;
 import org.apache.james.onami.lifecycle.PreDestroyModule;
 
 import com.google.inject.AbstractModule;
@@ -55,6 +56,7 @@ public class CommonServicesModule extends AbstractModule {
         install(new PreDestroyModule());
         install(new DNSServiceModule());
         install(new AsyncTasksExecutorModule());
+        install(new DropWizardMetricsModule());
 
         bind(FileSystemImpl.class).in(Scopes.SINGLETON);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/69769e04/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/DropWizardMetricsModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/DropWizardMetricsModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/DropWizardMetricsModule.java
new file mode 100644
index 0000000..31f66fa
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/DropWizardMetricsModule.java
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.modules.server;
+
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.metrics.dropwizard.DropWizardMetricFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
+
+public class DropWizardMetricsModule extends AbstractModule {
+
+    @Override
+    protected void configure() {
+        bind(DropWizardMetricFactory.class).in(Scopes.SINGLETON);
+        bind(MetricFactory.class).to(DropWizardMetricFactory.class);
+    }
+
+}


---------------------------------------------------------------------
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