Skip to content

PIP-231: Add metric for topic load failed #18979

@tjiuming

Description

@tjiuming

Motivation

Currently, we have a topic_load_times metric to track how long a topic load succeeds.
But when loading a topic, there may be some chances the topic load failed due to MetadataStore or Bookkeeper, and we don't have related metrics to track it.

Goal

Provide topic_load_failed_count metric to track topics loaded failed.

API Changes

No response

Implementation

Points

Topics are created in BrokerService.java.
For NonPersistentTopic:

    private CompletableFuture<Optional<Topic>> createNonPersistentTopic(String topic) {
        CompletableFuture<Optional<Topic>> topicFuture = new CompletableFuture<>();
        topicFuture.exceptionally(ex -> {
            // Record metric
            recordTopicLoadFailed();
        });

        // ignore ...
        return topicFuture;
    }

For PersistentTopic:

    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 load failed

Labels

  1. cluster: the cluster name of the broker belongs to.

Alternatives

No response

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions