tjiuming opened a new issue, #18979: URL: https://github.com/apache/pulsar/issues/18979
### Motivation Currently, we have `topic_load_times` metric to tracking how long a topic loaded succeed. But when loading a topic, there are may have some chances the topic loaded failed due to MetadataStore or Bookkeeper, and we don't have related metrics to track it. ### Goal Provide `topic_loaded_failed_count` metric to track topics loaded failed. ### API Changes _No response_ ### Implementation ### Points Topics are created in [BrokerService.java](https://github.com/tjiuming/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java). For [NonPersistentTopic](https://github.com/tjiuming/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L1166): ```java private CompletableFuture<Optional<Topic>> createNonPersistentTopic(String topic) { CompletableFuture<Optional<Topic>> topicFuture = new CompletableFuture<>(); topicFuture.exceptionally(ex -> { // Record metric recordTopicLoadFailed(); }); // ignore ... return topicFuture; ``` For [PersistentTopic](https://github.com/tjiuming/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L1508): ```java private void createPersistentTopic(final String topic, boolean createIfMissing, CompletableFuture<Optional<Topic>> topicFuture, Map<String, String> properties) { topicFuture.exceptionally(ex -> { // Record metric recordTopicLoadFailed(); }); // ignore.... } ``` ### Metrics | Name | Type | Description | | ------ | ----- | ----------- | | topic_load_failed | Counter | The number of topic loaded failed | #### Labels 1. cluster: the cluster name of the broker belongs to. ### Alternatives _No response_ ### Anything else? _No response_ -- 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]
