Rename package name from marvel.collector to marvel.agent. Also renamed CollectorService to AgentService

Closes #37
This commit is contained in:
Boaz Leskes 2014-01-22 13:07:31 +01:00
parent 5ecff51ab2
commit 524f407aaa
18 changed files with 137 additions and 97 deletions

16
.gitignore vendored
View file

@ -1,15 +1,15 @@
/work
/exporter/logs
.idea
/exporter/data
/exporter/target
/agent/logs
/agent/data
/agent/target
/agent/.project
/agent/.classpath
/agent/.settings
/agent/config
/agent/lib
.DS_Store
*.iml
/exporter/.project
/exporter/.classpath
/exporter/.settings
/exporter/config
/exporter/lib
/kibana/vendor/kibana
/node_modules
/build

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.collector;
package org.elasticsearch.marvel.agent;
/*
* 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.collector.event.*;
import org.elasticsearch.marvel.collector.exporter.ESExporter;
import org.elasticsearch.marvel.collector.exporter.Exporter;
import org.elasticsearch.marvel.agent.event.*;
import org.elasticsearch.marvel.agent.exporter.ESExporter;
import org.elasticsearch.marvel.agent.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 CollectorService extends AbstractLifecycleComponent<CollectorService> {
public class AgentService extends AbstractLifecycleComponent<AgentService> {
private final InternalIndicesService indicesService;
private final NodeService nodeService;
@ -87,10 +87,10 @@ public class CollectorService extends AbstractLifecycleComponent<CollectorServic
private final BlockingQueue<Event> pendingEventsQueue;
@Inject
public CollectorService(Settings settings, IndicesService indicesService,
NodeService nodeService, ClusterService clusterService,
Client client, Discovery discovery, ClusterName clusterName,
Environment environment, Plugin marvelPlugin) {
public AgentService(Settings settings, IndicesService indicesService,
NodeService nodeService, ClusterService clusterService,
Client client, Discovery discovery, ClusterName clusterName,
Environment environment, Plugin marvelPlugin) {
super(settings);
this.indicesService = (InternalIndicesService) indicesService;
this.clusterService = clusterService;
@ -122,7 +122,7 @@ public class CollectorService extends AbstractLifecycleComponent<CollectorServic
e.start();
this.exp = new ExportingWorker();
this.thread = new Thread(exp, EsExecutors.threadName(settings, "collector"));
this.thread = new Thread(exp, EsExecutors.threadName(settings, "marvel.exporters"));
this.thread.setDaemon(true);
this.thread.start();
@ -213,13 +213,13 @@ public class CollectorService extends AbstractLifecycleComponent<CollectorServic
try {
e.exportClusterStats(stats);
} catch (Throwable t) {
logger.error("Exporter [{}] has thrown an exception:", t, e.name());
logger.error("exporter [{}] has thrown an exception:", t, e.name());
}
}
}
private void exportEvents() {
logger.debug("Exporting events");
logger.debug("exporting events");
ArrayList<Event> eventList = new ArrayList<Event>(pendingEventsQueue.size());
pendingEventsQueue.drainTo(eventList);
Event[] events = new Event[eventList.size()];
@ -229,7 +229,7 @@ public class CollectorService extends AbstractLifecycleComponent<CollectorServic
try {
e.exportEvents(events);
} catch (Throwable t) {
logger.error("Exporter [{}] 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.collector;
package org.elasticsearch.marvel.agent;
import org.elasticsearch.Version;
import org.elasticsearch.common.collect.ImmutableList;
@ -69,7 +69,7 @@ public class Plugin extends AbstractPlugin {
@Override
protected void configure() {
bind(CollectorService.class).asEagerSingleton();
bind(AgentService.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(CollectorService.class);
l.add(AgentService.class);
}
return l;
}

View file

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

View file

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

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.collector.event;
package org.elasticsearch.marvel.agent.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.collector.Utils;
import org.elasticsearch.marvel.agent.Utils;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.collector.event;
package org.elasticsearch.marvel.agent.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.collector.Utils;
import org.elasticsearch.marvel.agent.Utils;
import java.io.IOException;
import java.util.Locale;

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.collector.exporter;
package org.elasticsearch.marvel.agent.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.collector.Plugin;
import org.elasticsearch.marvel.collector.Utils;
import org.elasticsearch.marvel.collector.event.Event;
import org.elasticsearch.marvel.agent.Plugin;
import org.elasticsearch.marvel.agent.Utils;
import org.elasticsearch.marvel.agent.event.Event;
import java.io.*;
import java.net.HttpURLConnection;

View file

@ -1,4 +1,4 @@
package org.elasticsearch.marvel.collector.exporter;
package org.elasticsearch.marvel.agent.exporter;
/*
* Licensed to ElasticSearch under one
* or more contributor license agreements. See the NOTICE file
@ -24,7 +24,7 @@ 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.collector.event.Event;
import org.elasticsearch.marvel.agent.event.Event;
public interface Exporter<T> extends LifecycleComponent<T> {

View file

@ -0,0 +1 @@
plugin=org.elasticsearch.marvel.agent.Plugin

View file

@ -0,0 +1,96 @@
{
"template": ".marvel*",
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"default": {
"type": "standard",
"stopwords": "_none_"
}
}
}
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"string_fields": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "multi_field",
"fields": {
"{name}": {
"type": "string",
"index": "analyzed",
"omit_norms": true
},
"raw": {
"type": "string",
"index": "not_analyzed",
"ignore_above": 256
}
}
}
}
}
]
},
"node_stats": {
"properties": {
"indices.percolate.size_in_bytes": {
"type": "long"
},
"jvm.buffer_pools.direct.used_in_bytes": {
"type": "long"
},
"jvm.buffer_pools.mapped.used_in_bytes": {
"type": "long"
},
"jvm.gc.collectors.young.collection_count": {
"type": "long"
},
"jvm.gc.collectors.young.collection_time_in_millis": {
"type": "long"
},
"jvm.gc.collectors.old.collection_count": {
"type": "long"
},
"jvm.gc.collectors.old.collection_time_in_millis": {
"type": "long"
},
"indices.percolate.total": {
"type": "long"
},
"indices.percolate.time_in_millis": {
"type": "long"
},
"indices.percolate.queries": {
"type": "long"
},
"indices.percolate.memory_size_in_bytes": {
"type": "long"
}
}
},
"index_stats": {
"properties": {
"total.percolate.memory_size_in_bytes": {
"type": "long"
},
"total.percolate.time_in_millis": {
"type": "long"
},
"total.percolate.queries": {
"type": "long"
},
"total.percolate.total": {
"type": "long"
}
}
}
}
}

View file

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

View file

@ -1,56 +0,0 @@
{
"template": ".marvel*",
"settings" : {
"number_of_shards": 1,
"number_of_replicas": 1,
"analysis" : {
"analyzer" : {
"default" : {
"type" : "standard",
"stopwords" : "_none_"
}
}
}
},
"mappings" : {
"_default_" : {
"dynamic_templates" : [ {
"string_fields" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "multi_field",
"fields" : {
"{name}" : {"type": "string", "index" : "analyzed", "omit_norms" : true },
"raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256}
}
}
}
} ]
},
"node_stats": {
"properties": {
"indices.percolate.size_in_bytes": { "type": "long"},
"jvm.buffer_pools.direct.used_in_bytes": { "type": "long" },
"jvm.buffer_pools.mapped.used_in_bytes": { "type": "long" },
"jvm.gc.collectors.young.collection_count": { "type": "long" },
"jvm.gc.collectors.young.collection_time_in_millis": { "type": "long" },
"jvm.gc.collectors.old.collection_count": { "type": "long" },
"jvm.gc.collectors.old.collection_time_in_millis": { "type": "long" },
"indices.percolate.total": { "type": "long" },
"indices.percolate.time_in_millis": { "type": "long" },
"indices.percolate.queries": { "type": "long" },
"indices.percolate.memory_size_in_bytes": { "type": "long"}
}
},
"index_stats": {
"properties": {
"total.percolate.memory_size_in_bytes": { "type": "long" },
"total.percolate.time_in_millis": { "type": "long" },
"total.percolate.queries": { "type": "long" },
"total.percolate.total": { "type": "long" }
}
}
}
}