yyj8 commented on code in PR #18116:
URL: https://github.com/apache/pulsar/pull/18116#discussion_r1012971635
##########
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:
Sorry, I misunderstood your description before
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);
```
> I think I misunderstood the original motivation for this PR. Is the issue
that you're unable to sum `pulsar_topics_count` while ignoring the `namespace`
label?
##########
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:
Sorry, I misunderstood your description before
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);
```
> I think I misunderstood the original motivation for this PR. Is the issue
that you're unable to sum `pulsar_topics_count` while ignoring the `namespace`
label?
--
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]