Marvel: Add heap to ClusterStats

Closes elastic/elasticsearch#593

Original commit: elastic/x-pack-elasticsearch@87a467ff13
This commit is contained in:
Tanguy Leroux 2015-09-07 10:19:12 +02:00
parent fcaa8d6a37
commit e08e587eb9
4 changed files with 21 additions and 7 deletions

View File

@ -27,6 +27,8 @@ public class ClusterStatsRenderer extends AbstractRenderer<ClusterStatsMarvelDoc
"cluster_stats.nodes.fs.free_in_bytes",
"cluster_stats.nodes.fs.available_in_bytes",
"cluster_stats.nodes.jvm.max_uptime_in_millis",
"cluster_stats.nodes.jvm.mem.heap_max_in_bytes",
"cluster_stats.nodes.jvm.mem.heap_used_in_bytes",
"cluster_stats.nodes.versions",
};

View File

@ -7,6 +7,7 @@ package org.elasticsearch.marvel;
import org.elasticsearch.Version;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.license.plugin.LicensePlugin;
import org.elasticsearch.node.MockNode;
import org.elasticsearch.node.Node;
@ -16,9 +17,11 @@ import java.util.concurrent.CountDownLatch;
/**
* Main class to easily run Marvel from a IDE.
* <p/>
* <p>
* In order to run this class set configure the following:
* 1) Set `-Des.path.home=` to a directory containing an ES config directory
*
* It accepts collectors names as program arguments.
*/
public class MarvelLauncher {
@ -28,6 +31,10 @@ public class MarvelLauncher {
settings.put("security.manager.enabled", "false");
settings.put("plugins.load_classpath_plugins", "false");
settings.put("cluster.name", MarvelLauncher.class.getSimpleName());
settings.put("marvel.agent.interval", "5s");
if (!CollectionUtils.isEmpty(args)) {
settings.putArray("marvel.agent.collectors", args);
}
final CountDownLatch latch = new CountDownLatch(1);
final Node node = new MockNode(settings.build(), Version.CURRENT, Arrays.asList(MarvelPlugin.class, LicensePlugin.class));

View File

@ -10,10 +10,10 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
import org.elasticsearch.marvel.agent.collector.cluster.ClusterStatsCollector;
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
import org.elasticsearch.marvel.agent.settings.MarvelSettings;
import org.elasticsearch.marvel.license.LicenseService;
import org.elasticsearch.test.ESIntegTestCase;
import org.junit.Test;
import java.util.Collection;
@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.*;
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, randomDynamicTemplates = false, transportClientRatio = 0.0, numDataNodes = 1, numClientNodes = 0)
public class IndexStatsCollectorTests extends AbstractCollectorTestCase {
@Test
@ -35,7 +36,6 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase {
}
@Test
@AwaitsFix(bugUrl = "https://github.com/elastic/x-plugins/pull/538")
public void testIndexStatsCollectorOneIndex() throws Exception {
waitForNoBlocksOnNodes();
@ -46,8 +46,9 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase {
client().prepareIndex(indexName, "test").setSource("num", i).get();
}
refresh();
waitForRelocation();
ensureGreen(indexName);
refresh();
assertHitCount(client().prepareCount().get(), nbDocs);
@ -92,7 +93,6 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase {
}
@Test
@AwaitsFix(bugUrl = "https://github.com/elastic/x-plugins/pull/538")
public void testIndexStatsCollectorMultipleIndices() throws Exception {
waitForNoBlocksOnNodes();
@ -113,8 +113,9 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase {
assertHitCount(client().prepareCount(indexPrefix + i).get(), docsPerIndex[i]);
}
refresh();
waitForRelocation();
ensureGreen();
refresh();
logger.debug("--> wait for index stats to report data about indices");
assertBusy(new Runnable() {

View File

@ -27,7 +27,11 @@
"2.0.0-SNAPSHOT"
],
"jvm": {
"max_uptime_in_millis": 75191
"max_uptime_in_millis": 75191,
"mem" : {
"heap_used_in_bytes" : 113643072,
"heap_max_in_bytes" : 3717201920
}
},
"fs": {
"total_in_bytes": 486599139328,