Rename package name from marvel.monitor to marvel.collector. Also renamed ExportersService to CollectorService & StatsExporter to just Exporter

Closes #31
This commit is contained in:
Boaz Leskes 2014-01-21 13:41:18 +01:00
parent cc80f35b12
commit ee3e09a775
12 changed files with 45 additions and 45 deletions

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor;
package org.elasticsearch.marvel.collector;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -53,9 +53,9 @@ import org.elasticsearch.index.shard.service.IndexShard;
import org.elasticsearch.indices.IndicesLifecycle;
import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.indices.InternalIndicesService;
import org.elasticsearch.marvel.monitor.event.*;
import org.elasticsearch.marvel.monitor.exporter.ESExporter;
import org.elasticsearch.marvel.monitor.exporter.StatsExporter;
import org.elasticsearch.marvel.collector.event.*;
import org.elasticsearch.marvel.collector.exporter.ESExporter;
import org.elasticsearch.marvel.collector.exporter.Exporter;
import org.elasticsearch.node.service.NodeService;
import java.util.ArrayList;
@ -65,7 +65,7 @@ import java.util.concurrent.BlockingQueue;
import static org.elasticsearch.common.collect.Lists.newArrayList;
public class ExportersService extends AbstractLifecycleComponent<ExportersService> {
public class CollectorService extends AbstractLifecycleComponent<CollectorService> {
private final InternalIndicesService indicesService;
private final NodeService nodeService;
@ -80,14 +80,14 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
private volatile Thread thread;
private final TimeValue interval;
private Collection<StatsExporter> exporters;
private Collection<Exporter> exporters;
private String[] indicesToExport = Strings.EMPTY_ARRAY;
private final BlockingQueue<Event> pendingEventsQueue;
@Inject
public ExportersService(Settings settings, IndicesService indicesService,
public CollectorService(Settings settings, IndicesService indicesService,
NodeService nodeService, ClusterService clusterService,
Client client, Discovery discovery, ClusterName clusterName,
Environment environment, Plugin marvelPlugin) {
@ -105,11 +105,11 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
pendingEventsQueue = ConcurrentCollections.newBlockingQueue();
if (componentSettings.getAsBoolean("enabled", true)) {
StatsExporter esExporter = new ESExporter(settings.getComponentSettings(ESExporter.class), discovery, clusterName, environment, marvelPlugin);
Exporter esExporter = new ESExporter(settings.getComponentSettings(ESExporter.class), discovery, clusterName, environment, marvelPlugin);
this.exporters = ImmutableSet.of(esExporter);
} else {
this.exporters = ImmutableSet.of();
logger.info("monitoring disabled by settings");
logger.info("collecting disabled by settings");
}
}
@ -118,11 +118,11 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
if (exporters.size() == 0) {
return;
}
for (StatsExporter e : exporters)
for (Exporter e : exporters)
e.start();
this.exp = new ExportingWorker();
this.thread = new Thread(exp, EsExecutors.threadName(settings, "monitor"));
this.thread = new Thread(exp, EsExecutors.threadName(settings, "collector"));
this.thread.setDaemon(true);
this.thread.start();
@ -142,7 +142,7 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
} catch (InterruptedException e) {
// we don't care...
}
for (StatsExporter e : exporters)
for (Exporter e : exporters)
e.stop();
indicesService.indicesLifecycle().removeListener(indicesLifeCycleListener);
@ -152,7 +152,7 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
@Override
protected void doClose() {
for (StatsExporter e : exporters)
for (Exporter e : exporters)
e.close();
}
@ -197,11 +197,11 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
private void exportIndicesStats() {
logger.debug("local node is master, exporting indices stats");
IndicesStatsResponse indicesStatsResponse = client.admin().indices().prepareStats().all().get();
for (StatsExporter e : exporters) {
for (Exporter e : exporters) {
try {
e.exportIndicesStats(indicesStatsResponse);
} catch (Throwable t) {
logger.error("StatsExporter [{}] has thrown an exception:", t, e.name());
logger.error("Exporter [{}] has thrown an exception:", t, e.name());
}
}
}
@ -209,11 +209,11 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
private void exportClusterStats() {
logger.debug("local node is master, exporting cluster stats");
ClusterStatsResponse stats = client.admin().cluster().prepareClusterStats().get();
for (StatsExporter e : exporters) {
for (Exporter e : exporters) {
try {
e.exportClusterStats(stats);
} catch (Throwable t) {
logger.error("StatsExporter [{}] has thrown an exception:", t, e.name());
logger.error("Exporter [{}] has thrown an exception:", t, e.name());
}
}
}
@ -225,11 +225,11 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
Event[] events = new Event[eventList.size()];
eventList.toArray(events);
for (StatsExporter e : exporters) {
for (Exporter e : exporters) {
try {
e.exportEvents(events);
} catch (Throwable t) {
logger.error("StatsExporter [{}] has thrown an exception:", t, e.name());
logger.error("Exporter [{}] has thrown an exception:", t, e.name());
}
}
}
@ -255,11 +255,11 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
ShardStats[] shardStatsArray = shardStats.toArray(new ShardStats[shardStats.size()]);
logger.debug("Exporting shards stats");
for (StatsExporter e : exporters) {
for (Exporter e : exporters) {
try {
e.exportShardStats(shardStatsArray);
} catch (Throwable t) {
logger.error("StatsExporter [{}] has thrown an exception:", t, e.name());
logger.error("exporter [{}] has thrown an exception:", t, e.name());
}
}
}
@ -269,11 +269,11 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
NodeStats nodeStats = nodeService.stats();
logger.debug("Exporting node stats");
for (StatsExporter e : exporters) {
for (Exporter e : exporters) {
try {
e.exportNodeStats(nodeStats);
} catch (Throwable t) {
logger.error("StatsExporter [{}] has thrown an exception:", t, e.name());
logger.error("exporter [{}] has thrown an exception:", t, e.name());
}
}
}

View file

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.marvel.monitor;
package org.elasticsearch.marvel.collector;
import org.elasticsearch.Version;
import org.elasticsearch.common.collect.ImmutableList;
@ -69,7 +69,7 @@ public class Plugin extends AbstractPlugin {
@Override
protected void configure() {
bind(ExportersService.class).asEagerSingleton();
bind(CollectorService.class).asEagerSingleton();
}
};
return ImmutableList.of(m);
@ -79,7 +79,7 @@ public class Plugin extends AbstractPlugin {
public Collection<Class<? extends LifecycleComponent>> services() {
Collection<Class<? extends LifecycleComponent>> l = new ArrayList<Class<? extends LifecycleComponent>>();
if (enabled) {
l.add(ExportersService.class);
l.add(CollectorService.class);
}
return l;
}

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor;
package org.elasticsearch.marvel.collector;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.event;
package org.elasticsearch.marvel.collector.event;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.event;
package org.elasticsearch.marvel.collector.event;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.event;
package org.elasticsearch.marvel.collector.event;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.event;
package org.elasticsearch.marvel.collector.event;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -22,7 +22,7 @@ package org.elasticsearch.marvel.monitor.event;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.marvel.monitor.Utils;
import org.elasticsearch.marvel.collector.Utils;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.event;
package org.elasticsearch.marvel.collector.event;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -23,7 +23,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.marvel.monitor.Utils;
import org.elasticsearch.marvel.collector.Utils;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.event;
package org.elasticsearch.marvel.collector.event;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -25,7 +25,7 @@ import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.shard.IndexShardState;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.marvel.monitor.Utils;
import org.elasticsearch.marvel.collector.Utils;
import java.io.IOException;
import java.util.Locale;

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.exporter;
package org.elasticsearch.marvel.collector.exporter;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -41,9 +41,9 @@ import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.common.xcontent.smile.SmileXContent;
import org.elasticsearch.discovery.Discovery;
import org.elasticsearch.env.Environment;
import org.elasticsearch.marvel.monitor.Plugin;
import org.elasticsearch.marvel.monitor.Utils;
import org.elasticsearch.marvel.monitor.event.Event;
import org.elasticsearch.marvel.collector.Plugin;
import org.elasticsearch.marvel.collector.Utils;
import org.elasticsearch.marvel.collector.event.Event;
import java.io.*;
import java.net.HttpURLConnection;
@ -52,7 +52,7 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Map;
public class ESExporter extends AbstractLifecycleComponent<ESExporter> implements StatsExporter<ESExporter> {
public class ESExporter extends AbstractLifecycleComponent<ESExporter> implements Exporter<ESExporter> {
volatile String[] hosts;
final String indexPrefix;

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.monitor.exporter;
package org.elasticsearch.marvel.collector.exporter;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -24,9 +24,9 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.marvel.monitor.event.Event;
import org.elasticsearch.marvel.collector.event.Event;
public interface StatsExporter<T> extends LifecycleComponent<T> {
public interface Exporter<T> extends LifecycleComponent<T> {
String name();

View file

@ -1 +1 @@
plugin=org.elasticsearch.marvel.monitor.Plugin
plugin=org.elasticsearch.marvel.collector.Plugin