yyj8 commented on code in PR #18116:
URL: https://github.com/apache/pulsar/pull/18116#discussion_r1012979371
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/NamespaceStatsAggregator.java:
##########
@@ -70,7 +71,19 @@ public static void generate(PulsarService pulsar, boolean
includeTopicMetrics, b
LongAdder topicsCount = new LongAdder();
Map<String, Long> localNamespaceTopicCount = new HashMap<>();
- printDefaultBrokerStats(stream, cluster);
+ LongAdder brokerTopicsCount = new LongAdder();
Review Comment:
The metrics name is still use the original name. To get the broker dimension
metrics, we can set the `namespace` label as an empty string.
for example:
`pulsar_rate_in{namespace=""}`
After testing, queries are much faster than summarizing all topics. Even
after the query time interval reaches several days, the results cannot be found
by summarizing all topics, but the results can be found quickly by summarizing
the broker metrics.
```
writeMetric(stream, "pulsar_topics_count", brokerStats.topicsCount, cluster);
writeMetric(stream, "pulsar_subscriptions_count",
brokerStats.subscriptionsCount, cluster);
writeMetric(stream, "pulsar_producers_count", brokerStats.producersCount,
cluster);
writeMetric(stream, "pulsar_consumers_count", brokerStats.consumersCount,
cluster);
writeMetric(stream, "pulsar_rate_in", brokerStats.rateIn, cluster);
writeMetric(stream, "pulsar_rate_out", brokerStats.rateOut, cluster);
writeMetric(stream, "pulsar_throughput_in", brokerStats.throughputIn,
cluster);
writeMetric(stream, "pulsar_throughput_out", brokerStats.throughputOut,
cluster);
writeMetric(stream, "pulsar_storage_size", brokerStats.storageSize, cluster);
writeMetric(stream, "pulsar_storage_logical_size",
brokerStats.storageLogicalSize, cluster);
writeMetric(stream, "pulsar_storage_write_rate",
brokerStats.storageWriteRate, cluster);
writeMetric(stream, "pulsar_storage_read_rate", brokerStats.storageReadRate,
cluster);
writeMetric(stream, "pulsar_msg_backlog", brokerStats.msgBacklog, cluster);
```
--
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]