moved to elasticsearch-enterprise - part 2

This commit is contained in:
Boaz Leskes 2013-09-27 16:55:18 +02:00
parent e109697b48
commit 53bf11bbbc
6 changed files with 29 additions and 30 deletions

View file

@ -25,7 +25,7 @@
</parent>
<properties>
<elasticsearch.version>0.90.5</elasticsearch.version>
<elasticsearch.version>0.90.6-SNAPSHOT</elasticsearch.version>
</properties>
<repositories>

View file

@ -17,9 +17,9 @@
* under the License.
*/
package com.elasticsearch.dash;
package org.elasticsearch.enterprise.monitor;
import com.google.common.collect.ImmutableList;
import org.elasticsearch.common.collect.ImmutableList;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Module;

View file

@ -1,4 +1,5 @@
package com.elasticsearch.dash;/*
package org.elasticsearch.enterprise.monitor;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -18,8 +19,8 @@ package com.elasticsearch.dash;/*
*/
import com.elasticsearch.dash.exporters.ESExporter;
import com.google.common.collect.ImmutableSet;
import org.elasticsearch.common.collect.ImmutableSet;
import org.elasticsearch.enterprise.monitor.exporter.ESExporter;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
@ -30,6 +31,7 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.enterprise.monitor.exporter.StatsExporter;
import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.indices.InternalIndicesService;
import org.elasticsearch.node.service.NodeService;
@ -105,18 +107,18 @@ public class StatsExportersService extends AbstractLifecycleComponent<StatsExpor
}
}
logger.debug("Collecting shard stats");
List<ShardStats> shardStatsList = indicesService.shardLevelStats(CommonStatsFlags.ALL);
logger.debug("Exporting shards stats");
for (StatsExporter e : exporters) {
try {
for (ShardStats shardStats : shardStatsList)
e.exportShardStats(shardStats);
} catch (Throwable t) {
logger.error("StatsExporter {} has thrown an exception:", t, e.name());
}
}
// logger.warn("Collecting shard stats");
// List<ShardStats> shardStatsList = indicesService.shardLevelStats(CommonStatsFlags.ALL);
//
// logger.debug("Exporting shards stats");
// for (StatsExporter e : exporters) {
// try {
// for (ShardStats shardStats : shardStatsList)
// e.exportShardStats(shardStats);
// } catch (Throwable t) {
// logger.error("StatsExporter {} has thrown an exception:", t, e.name());
// }
// }
} catch (Throwable t) {
logger.error("Background thread had an uncaught exception:", t);
}

View file

@ -1,4 +1,4 @@
package com.elasticsearch.dash.exporters;
package org.elasticsearch.enterprise.monitor.exporter;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -19,8 +19,7 @@ package com.elasticsearch.dash.exporters;
*/
import com.elasticsearch.dash.StatsExporter;
import com.google.common.collect.ImmutableMap;
import org.elasticsearch.common.collect.ImmutableMap;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
@ -65,19 +64,18 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
// TODO: move to a single settings.
targetHost = settings.get("target.host", "localhost");
targetPort = settings.getAsInt("target.post", 9200);
String targetIndexPrefix = settings.get("target.index.prefix", "dash");
String targetIndexPrefix = settings.get("target.index.prefix", "");
try {
targetPathPrefix = String.format("/%s_%s_",
URLEncoder.encode(targetIndexPrefix,"UTF-8"),
URLEncoder.encode(clusterName.value(),"UTF-8"));
if (!targetIndexPrefix.isEmpty()) targetIndexPrefix += targetIndexPrefix + "_";
targetPathPrefix = "/"+ URLEncoder.encode(targetIndexPrefix,"UTF-8") + URLEncoder.encode(clusterName.value(),"UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ElasticSearchException("Can't encode target url", e);
}
xContentParams = new ToXContent.MapParams(ImmutableMap.of("human_readable","false"));
xContentParams = new ToXContent.MapParams(ImmutableMap.of("human_readable", "false"));
logger.info("ESExporter initialized. Target: {}:{} Index prefix set to {}", targetHost, targetPort, targetIndexPrefix );
@ -108,7 +106,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
@Override
public void exportShardStats(ShardStats shardStats) {
exportXContent("shardstats", shardStats);
//exportXContent("shardstats", shardStats);
}
private void exportXContent(String type,ToXContent xContent) {

View file

@ -1,4 +1,4 @@
package com.elasticsearch.dash;
package org.elasticsearch.enterprise.monitor.exporter;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -21,7 +21,6 @@ package com.elasticsearch.dash;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.common.component.CloseableComponent;
import org.elasticsearch.common.component.LifecycleComponent;
public interface StatsExporter<T> extends LifecycleComponent<T> {

View file

@ -1 +1 @@
plugin=com.elasticsearch.dash.Plugin
plugin=org.elasticsearch.enterprise.monitor.Plugin