yyj8 commented on code in PR #18116:
URL: https://github.com/apache/pulsar/pull/18116#discussion_r1008626435
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/NamespaceStatsAggregator.java:
##########
@@ -302,22 +315,22 @@ private static void getTopicStats(Topic topic, TopicStats
stats, boolean include
});
}
- private static void printDefaultBrokerStats(PrometheusMetricStreams
stream, String cluster) {
- // Print metrics with 0 values. This is necessary to have the
available brokers being
+ private static void printBrokerStats(PrometheusMetricStreams stream,
String cluster, AggregatedBrokerStats brokerStats) {
Review Comment:
When `exposeTopicLevelMetricsInPrometheus=true`, pulsar will expose topic
partition level metrics. For getting the total number of topics, it is really
possible to summarize the number of topics in all namespaces, and the number of
namespaces is usually small.
But if you want to get the broker dimension other metrics, example :
`pulsar_rate_in、pulsar_rate_out、pulsar_throughput_in、pulsar_throughput_out `
and so on, will have to summarize the data of all topic partitions.
When there are few topic partitions, such as less than 10000, it is very
quick to directly summarize the metrics of topic dimensions. However, when the
topic partition exceeds 100000, or even millions, it is likely that the result
data cannot be queried from prometheus.
The structure of `pulsar_topics_count` metrics in Prometheus is as follows:
`pulsar_topics_count{app="pulsar", cluster="pulsar-cluster",
component="broker", namespace="mytenant/mynamespace",
instance="xxx.xxx.xx.xx:8080", pod="pulsar-cluster-broker-1"}`
You can get the total number of topic through the following prometheus query:
`sum(pulsar_topics_count{cluster="$cluster",component="broker"})`
The structure of `pulsar_rate_in` metrics in Prometheus is as follows:
`pulsar_rate_in{app="pulsar", cluster="pulsar-cluster", component="broker",
namespace="mytenant/mynamespace",instance="xxx.xxx.xx.xx:8080",
pod="pulsar-cluster-broker-1",
topic="persistent://mytenant/mynamespace/mytopic-partition-0"}`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]