in src/main/java/org/apache/pulsar/manager/mapper/TopicsStatsMapper.java [50:83]
Page<TopicStatsEntity> findByClusterBroker(
@Param("environment") String environment,
@Param("cluster") String cluster,
@Param("broker") String broker,
@Param("timestamp") long timestamp);
@Select("SELECT topic_stats_id as topicStatsId,environment as environment,cluster as cluster,broker as broker," +
"tenant as tenant,namespace as namespace,bundle as bundle,persistent as persistent," +
"topic as topic,producer_count as producerCount,subscription_count as subscriptionCount," +
"msg_rate_in as msgRateIn,msg_throughput_in as msgThroughputIn,msg_rate_out as msgRateOut," +
"msg_throughput_out as msgThroughputOut,average_msg_size as averageMsgSize,storage_size as storageSize," +
"time_stamp FROM topics_stats " +
"WHERE environment=#{environment} and tenant=#{tenant} and namespace=#{namespace} " +
"and time_stamp=#{timestamp}")
Page<TopicStatsEntity> findByNamespace(
@Param("environment") String environment,
@Param("tenant") String tenant,
@Param("namespace") String namespace,
@Param("timestamp") long timestamp);
@Select({"<script>",
"SELECT environment, cluster, tenant, namespace, persistent, topic,"
+ "sum(producer_count) as producerCount,"
+ "sum(subscription_count) as subscriptionCount,"
+ "sum(msg_rate_in) as msgRateIn,"
+ "sum(msg_throughput_in) as msgThroughputIn,"
+ "sum(msg_rate_out) as msgRateOut,"
+ "sum(msg_throughput_out) as msgThroughputOut,"
+ "avg(average_msg_size) as averageMsgSize,"
+ "sum(storage_size) as storageSize, time_stamp FROM topics_stats",
"WHERE environment=#{environment} and tenant=#{tenant} and namespace=#{namespace} and time_stamp=#{timestamp} and " +
"topic IN <foreach collection='topicList' item='topic' open='(' separator=',' close=')'> #{topic} </foreach>" +
"GROUP BY environment, cluster, tenant, namespace, persistent, topic, time_stamp" +
"</script>"})