Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Rashid Khan 2014-01-13 15:46:40 -08:00
commit a29141d142
4 changed files with 21 additions and 20 deletions

View file

@ -19,7 +19,6 @@ package org.elasticsearch.marvel.monitor;
*/
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterIndexHealth;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
@ -27,7 +26,6 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.action.support.IgnoreIndices;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterChangedEvent;
import org.elasticsearch.cluster.ClusterName;
@ -116,7 +114,7 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
}
@Override
protected void doStart() throws ElasticSearchException {
protected void doStart() {
if (exporters.size() == 0) {
return;
}
@ -133,7 +131,7 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
}
@Override
protected void doStop() throws ElasticSearchException {
protected void doStop() {
if (exporters.size() == 0) {
return;
}
@ -153,7 +151,7 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
}
@Override
protected void doClose() throws ElasticSearchException {
protected void doClose() {
for (StatsExporter e : exporters)
e.close();
}
@ -238,7 +236,7 @@ public class ExportersService extends AbstractLifecycleComponent<ExportersServic
private void exportShardStats() {
logger.debug("Collecting shard stats");
String[] indices = clusterService.state().metaData().concreteIndices(indicesToExport, IgnoreIndices.DEFAULT, true);
String[] indices = clusterService.state().metaData().concreteIndices(indicesToExport);
List<ShardStats> shardStats = newArrayList();
for (String index : indices) {

View file

@ -19,7 +19,6 @@ package org.elasticsearch.marvel.monitor.event;
*/
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.common.xcontent.ToXContent;
@ -74,7 +73,7 @@ public class ShardEvent extends Event {
case CLOSED:
return new DescriptionBuilder(shardRouting, "closed", node).relocatedTo(relocatingNode).build();
default:
throw new ElasticSearchException("unmapped shard event type [" + shardState + "]");
throw new RuntimeException("unmapped shard event type [" + shardState + "]");
}
}

View file

@ -19,7 +19,6 @@ package org.elasticsearch.marvel.monitor.exporter;
*/
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
import org.elasticsearch.action.admin.indices.stats.CommonStats;
@ -189,7 +188,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
if (!checkedAndUploadedAllResources) {
try {
checkedAndUploadedAllResources = checkAndUploadAllResources();
} catch (ElasticSearchException e) {
} catch (RuntimeException e) {
logger.error("failed to upload critical resources, stopping export", e);
return null;
}
@ -259,7 +258,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
}
@Override
protected void doStart() throws ElasticSearchException {
protected void doStart() {
// not initializing keep alive worker here but rather upon first exporting.
// In the case we are sending metrics to the same ES as where the plugin is hosted
// we want to give it some time to start.
@ -267,7 +266,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
@Override
protected void doStop() throws ElasticSearchException {
protected void doStop() {
if (keepAliveWorker != null) {
keepAliveWorker.closed = true;
keepAliveThread.interrupt();
@ -280,7 +279,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
}
@Override
protected void doClose() throws ElasticSearchException {
protected void doClose() {
}
@ -404,7 +403,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
try {
return URLEncoder.encode(s, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ElasticSearchException("failed to url encode [" + s + "]", e);
throw new RuntimeException("failed to url encode [" + s + "]", e);
}
}
@ -459,13 +458,13 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
} catch (IOException e) {
// throwing an exception to stop exporting process - we don't want to send data unless
// we put in the template for it.
throw new ElasticSearchException("failed to load marvel_index_template.json", e);
throw new RuntimeException("failed to load marvel_index_template.json", e);
}
try {
return checkAndUpload("_template/marvel", template);
} catch (IOException e) {
// if we're not sure of the template, we can't send data... re-raise exception.
throw new ElasticSearchException("failed to load/verify index template", e);
throw new RuntimeException("failed to load/verify index template", e);
}
}

View file

@ -41,7 +41,7 @@ define([
return fieldName.replace(/\.raw$/, '');
}
module.controller('marvel.stats_table', function ($scope, dashboard, filterSrv, $filter, alertSrv) {
module.controller('marvel.stats_table', function ($scope, dashboard, filterSrv, esVersion, $filter, alertSrv) {
$scope.panelMeta = {
modals: [],
editorTabs: [],
@ -397,9 +397,14 @@ define([
}
hit = response.hits.hits[0];
display_name = hit.fields[stripRaw($scope.panel.display_field)];
persistent_name = hit.fields[stripRaw($scope.panel.persistent_field)];
if (esVersion.gte("1.0.0.RC1")) {
display_name = (hit.fields[stripRaw($scope.panel.display_field)] || [ undefined ])[0];
persistent_name = (hit.fields[stripRaw($scope.panel.persistent_field)] || [ undefined] )[0];
}
else {
display_name = hit.fields[stripRaw($scope.panel.display_field)];
persistent_name = hit.fields[stripRaw($scope.panel.persistent_field)];
}
newRows.push({
display_name: display_name || persistent_name,
id: persistent_name,