Skip to content

Commit

Permalink
Show governor ip in memq cluster page; Show StorageHandler in topic c…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
yisheng-zhou committed Apr 3, 2024
1 parent 0ad29fc commit 2c05cce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@
import com.pinterest.orion.core.memq.MemqCluster;
import com.pinterest.orion.utils.NetworkUtils;

import static com.pinterest.orion.core.memq.MemqCluster.CLUSTER_CONTEXT;

public class MemqClusterSensor extends MemqSensor {

public static final String WRITE_ASSIGNMENTS = "writeAssignments";
public static final String TOPIC_CONFIG = "topicconfig";
public static final String BROKERS = "/brokers";
public static final String TOPICS = "/topics";
public static final String GOVERNOR = "/governor";
public static final String RAW_BROKER_INFO = "rawBrokerInfo";

@Override
Expand Down Expand Up @@ -102,9 +105,15 @@ public void sense(MemqCluster cluster) throws Exception {
TopicConfig topicConfig = gson.fromJson(new String(topicData), TopicConfig.class);
topicConfigMap.put(topic, topicConfig);
}

byte[] governorData = zkClient.getData().forPath(GOVERNOR);
String governorIp = new String(governorData);
String clusterContext = "Governor: " + governorIp + "\n";

setAttribute(cluster, TOPIC_CONFIG, topicConfigMap);
setAttribute(cluster, RAW_BROKER_INFO, rawBrokerMap);
setAttribute(cluster, WRITE_ASSIGNMENTS, writeBrokerAssignments);
setAttribute(cluster, CLUSTER_CONTEXT, clusterContext);
} catch (Exception e) {
e.printStackTrace();
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class MemqCluster extends Cluster {
public static final String SERVERSET_PATH = "serversetPath";
public static final String ZK_CONNECTION_STRING = "zkConnectionString";
public static final String CLUSTER_REGION = "region";
public static final String CLUSTER_CONTEXT = "cluster.context";
public static final String DEFAULT_REGION = "us-east-1";
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(MemqCluster.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,20 @@ export default function ClusterSummary(props) {
</Box>
</Paper>
);
} else {
} else if (cluster.attributes["cluster.context"]) {
return (
<Paper variant="outlined">
<Box mx={2} my={1}>
<Typography
variant="caption"
>
{cluster.attributes["cluster.context"]}
</Typography>
</Box>
</Paper>
);
}
else {
return <div></div>;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default function Topics(props) {
batchSizeMB: topicInfoRow.config.batchSizeMB,
configs: topicInfoRow.configs,
storageConfigs: topicInfoRow.config.storageHandlerConfig,
storageHandlerName: topicInfoRow.config.storageHandlerName,
raw: topicInfoRow,
};
});
Expand Down

0 comments on commit 2c05cce

Please sign in to comment.