Skip to content

Add metrics related to leader #1117

@jrhee17

Description

@jrhee17

Sometimes we notice that replica.has.leadership reports 1 for more than one central dogma instance within a cluster.

ref:

In order to troubleshoot this issue, I propose that we add a metric which indicates who curator thinks the actual leader is. This way, we can narrow down the scope of the issue.

leaderSelector.setId(String.valueOf(replicaId()));
Gauge.builder("leader", () -> {
    try {
        // this may be blocking
        return Integer.valueOf(leaderSelector.getLeader().getId());
    } catch (Exception e) {
        return -1;
    }
});

We can also potentially log leaderSelector.getParticipants() since this basically returns the order which will receive leadership (the first element is the leader).

@ikhoon also gave a good idea to add logs for more curator callbacks.

e.g.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions