You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/02/28 11:45:13 UTC
[6/6] james-project git commit: MAILBOX-287 Allow publishing metrics
also when connected to a cluster
MAILBOX-287 Allow publishing metrics also when connected to a cluster
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/fbcfb025
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/fbcfb025
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/fbcfb025
Branch: refs/heads/master
Commit: fbcfb02540885f4809616a021cffccc987bf04d5
Parents: 94f7a41
Author: benwa <bt...@linagora.com>
Authored: Fri Feb 24 11:58:28 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Tue Feb 28 18:44:33 2017 +0700
----------------------------------------------------------------------
.../cassandra-ldap/destination/conf/elasticsearch.properties | 2 ++
.../guice/cassandra/destination/conf/elasticsearch.properties | 2 ++
.../apache/james/modules/server/ESMetricReporterModule.java | 7 ++++++-
3 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/fbcfb025/dockerfiles/run/guice/cassandra-ldap/destination/conf/elasticsearch.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/conf/elasticsearch.properties b/dockerfiles/run/guice/cassandra-ldap/destination/conf/elasticsearch.properties
index 6d17382..1adf0d2 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/elasticsearch.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/elasticsearch.properties
@@ -34,6 +34,8 @@ elasticsearch.retryConnection.minDelay=3000
elasticsearch.indexAttachments=true
# Reports for metrics into ElasticSearch
+# Defaults to elasticsearch.masterHost : on which server to publish metrics
+elasticsearch.http.host=elasticsearch
elasticsearch.http.port=9200
elasticsearch.metrics.reports.enabled=true
elasticsearch.metrics.reports.period=30
http://git-wip-us.apache.org/repos/asf/james-project/blob/fbcfb025/dockerfiles/run/guice/cassandra/destination/conf/elasticsearch.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra/destination/conf/elasticsearch.properties b/dockerfiles/run/guice/cassandra/destination/conf/elasticsearch.properties
index 6d17382..1adf0d2 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/elasticsearch.properties
+++ b/dockerfiles/run/guice/cassandra/destination/conf/elasticsearch.properties
@@ -34,6 +34,8 @@ elasticsearch.retryConnection.minDelay=3000
elasticsearch.indexAttachments=true
# Reports for metrics into ElasticSearch
+# Defaults to elasticsearch.masterHost : on which server to publish metrics
+elasticsearch.http.host=elasticsearch
elasticsearch.http.port=9200
elasticsearch.metrics.reports.enabled=true
elasticsearch.metrics.reports.period=30
http://git-wip-us.apache.org/repos/asf/james-project/blob/fbcfb025/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
index f43c5cf..d0229dd 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
@@ -61,7 +61,7 @@ public class ESMetricReporterModule extends AbstractModule {
if (isMetricEnable(propertiesReader)) {
return ESReporterConfiguration.builder()
.enabled()
- .onHost(propertiesReader.getString(ElasticSearchMailboxModule.ELASTICSEARCH_MASTER_HOST),
+ .onHost(locateHost(propertiesReader),
propertiesReader.getInt("elasticsearch.http.port", DEFAULT_ES_HTTP_PORT))
.onIndex(propertiesReader.getString("elasticsearch.metrics.reports.index", null))
.periodInSecond(propertiesReader.getLong("elasticsearch.metrics.reports.period", null))
@@ -75,6 +75,11 @@ public class ESMetricReporterModule extends AbstractModule {
.build();
}
+ private String locateHost(PropertiesConfiguration propertiesReader) {
+ return propertiesReader.getString("elasticsearch.http.host",
+ propertiesReader.getString(ElasticSearchMailboxModule.ELASTICSEARCH_MASTER_HOST));
+ }
+
private boolean isMetricEnable(PropertiesConfiguration propertiesReader) {
return propertiesReader.getBoolean("elasticsearch.metrics.reports.enabled", DEFAULT_DISABLE);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org