Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Rename package name from marvel.monitor to marvel.collector. Also…
Browse files Browse the repository at this point in the history
… renamed `ExportersService` to `CollectorService` & `StatsExporter` to just `Exporter`

Closes #31
  • Loading branch information
bleskes committed Jan 21, 2014
1 parent cc80f35 commit ee3e09a
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -53,9 +53,9 @@
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;
Expand All @@ -65,7 +65,7 @@

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;
Expand All @@ -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) {
Expand All @@ -105,11 +105,11 @@ public ExportersService(Settings settings, IndicesService indicesService,
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");
}
}

Expand All @@ -118,11 +118,11 @@ protected void doStart() {
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();

Expand All @@ -142,7 +142,7 @@ protected void doStop() {
} catch (InterruptedException e) {
// we don't care...
}
for (StatsExporter e : exporters)
for (Exporter e : exporters)
e.stop();

indicesService.indicesLifecycle().removeListener(indicesLifeCycleListener);
Expand All @@ -152,7 +152,7 @@ protected void doStop() {

@Override
protected void doClose() {
for (StatsExporter e : exporters)
for (Exporter e : exporters)
e.close();
}

Expand Down Expand Up @@ -197,23 +197,23 @@ public void run() {
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());
}
}
}

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());
}
}
}
Expand All @@ -225,11 +225,11 @@ private void exportEvents() {
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());
}
}
}
Expand All @@ -255,11 +255,11 @@ private void exportShardStats() {
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());
}
}
}
Expand All @@ -269,11 +269,11 @@ private void exportNodeStats() {
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());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -69,7 +69,7 @@ public Collection<Module> modules(Settings settings) {

@Override
protected void configure() {
bind(ExportersService.class).asEagerSingleton();
bind(CollectorService.class).asEagerSingleton();
}
};
return ImmutableList.of(m);
Expand All @@ -79,7 +79,7 @@ protected void configure() {
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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -22,7 +22,7 @@
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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,7 +23,7 @@
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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,7 +25,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -41,9 +41,9 @@
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;
Expand All @@ -52,7 +52,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,9 +24,9 @@
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();

Expand Down
2 changes: 1 addition & 1 deletion exporter/src/main/resources/es-plugin.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
plugin=org.elasticsearch.marvel.monitor.Plugin
plugin=org.elasticsearch.marvel.collector.Plugin

0 comments on commit ee3e09a

Please sign in to comment.