in src/main/java/org/apache/pulsar/manager/service/impl/NamespacesServiceImpl.java [130:159]
public Map<String, Object> getNamespaceStats(
String tenant,
String namespace,
String env) {
Map<String, Object> namespaceStatsMap = Maps.newHashMap();
Optional<TopicStatsEntity> topicStatsEntity = topicsStatsRepository.findMaxTime();
if (topicStatsEntity.isPresent()) {
double msgRateIn = 0;
double msgThroughputIn = 0;
double msgRateOut = 0;
double msgThroughputOut = 0;
TopicStatsEntity topicStats = topicStatsEntity.get();
Page<TopicStatsEntity> topicCountPage = topicsStatsRepository.findByNamespace(
1, 1, env, tenant, namespace, topicStats.getTime_stamp());
topicCountPage.count(true);
Page<TopicStatsEntity> topicStatsEntities = topicsStatsRepository.findByNamespace(
1, (int) topicCountPage.getTotal(), env, tenant, namespace, topicStats.getTime_stamp());
for (TopicStatsEntity statsEntity : topicStatsEntities.getResult()) {
msgRateIn += statsEntity.getMsgRateIn();
msgRateOut += statsEntity.getMsgRateOut();
msgThroughputIn += statsEntity.getMsgThroughputIn();
msgThroughputOut += statsEntity.getMsgThroughputOut();
}
namespaceStatsMap.put("inMsg", msgRateIn);
namespaceStatsMap.put("outMsg", msgRateOut);
namespaceStatsMap.put("msgThroughputIn", msgThroughputIn);
namespaceStatsMap.put("msgThroughputOut", msgThroughputOut);
}
return namespaceStatsMap;
}