Skip to content

Commit

Permalink
Only collect display name (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Nov 1, 2018
1 parent eb56414 commit e4689df
Showing 1 changed file with 7 additions and 9 deletions.
Expand Up @@ -47,7 +47,7 @@ public class ClusterStatsMonitoringDoc extends MonitoringDoc {
ClusterState.Metric.NODES));

public static final String TYPE = "cluster_stats";
protected static final String SETTING_CLUSTER_METADATA = "cluster.metadata";
protected static final String SETTING_DISPLAY_NAME = "cluster.metadata.display_name";

private final String clusterName;
private final String version;
Expand Down Expand Up @@ -121,12 +121,12 @@ boolean getClusterNeedsTLSEnabled() {
return clusterNeedsTLSEnabled;
}

Settings getClusterMetaDataSettings() {
String getClusterDisplayName() {
MetaData metaData = this.clusterState.getMetaData();
if (metaData == null) {
return Settings.EMPTY;
return null;
}
return metaData.settings().getAsSettings(SETTING_CLUSTER_METADATA);
return metaData.settings().get(SETTING_DISPLAY_NAME);
}

@Override
Expand Down Expand Up @@ -167,21 +167,19 @@ protected void innerToXContent(XContentBuilder builder, Params params) throws IO
builder.endObject();
}

Settings clusterMetaDataSettings = getClusterMetaDataSettings();
if (clusterMetaDataSettings != null) {
String displayName = getClusterDisplayName();
if (displayName != null) {
builder.startObject("cluster_settings");
{
if (clusterMetaDataSettings.size() > 0) {
builder.startObject("cluster");
{
builder.startObject("metadata");
{
clusterMetaDataSettings.toXContent(builder, params);
builder.field("display_name", displayName);
}
builder.endObject();
}
builder.endObject();
}
}
builder.endObject();
}
Expand Down

0 comments on commit e4689df

Please sign in to comment.