yyj8 commented on code in PR #18116:
URL: https://github.com/apache/pulsar/pull/18116#discussion_r1007056711
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/NamespaceStatsAggregator.java:
##########
@@ -302,22 +335,35 @@ 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,
+ LongAdder brokerTopicsCount,
+ LongAdder brokerSubscriptionsCount,
+ LongAdder brokerProducersCount,
+ LongAdder brokerConsumersCount,
+ DoubleAdder brokerRateIn,
+ DoubleAdder brokerRateOut,
+ DoubleAdder brokerThroughputIn,
+ DoubleAdder brokerThroughputOut,
+ DoubleAdder brokerStorageSize,
+ DoubleAdder brokerStorageLogicalSize,
+ DoubleAdder brokerStorageWriteRate,
+ DoubleAdder brokerStorageReadRate,
+ DoubleAdder brokerMsgBacklog) {
+ // Print metrics values. This is necessary to have the available
brokers being
// reported in the brokers dashboard even if they don't have any topic
or traffic
- writeMetric(stream, "pulsar_topics_count", 0, cluster);
- writeMetric(stream, "pulsar_subscriptions_count", 0, cluster);
- writeMetric(stream, "pulsar_producers_count", 0, cluster);
- writeMetric(stream, "pulsar_consumers_count", 0, cluster);
- writeMetric(stream, "pulsar_rate_in", 0, cluster);
- writeMetric(stream, "pulsar_rate_out", 0, cluster);
- writeMetric(stream, "pulsar_throughput_in", 0, cluster);
- writeMetric(stream, "pulsar_throughput_out", 0, cluster);
- writeMetric(stream, "pulsar_storage_size", 0, cluster);
- writeMetric(stream, "pulsar_storage_logical_size", 0, cluster);
- writeMetric(stream, "pulsar_storage_write_rate", 0, cluster);
- writeMetric(stream, "pulsar_storage_read_rate", 0, cluster);
- writeMetric(stream, "pulsar_msg_backlog", 0, cluster);
+ writeMetric(stream, "pulsar_broker_topics_count",
brokerTopicsCount.longValue(), cluster);
Review Comment:
dear asafm Asaf Mesika
Thank you for your suggestion.
The main reason why I want to make some adjustments here is to improve the
performance of querying broker dimension metric from prometheus, instead of
filtering from massive topic metrics data. Because if use the same metric name
will be stored together, if you want to get the broker dimension metrics, you
have to summarize all topic metrics.
--
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]