jstests/replsets/server_election_metrics.js
// Verifies the format of the 'electionMetrics' serverStatus section.
Verifies the format of the 'electionMetrics' serverStatus section.
Verifies the format of the ' electionMetrics ' serverStatus section .
function verifyElectionMetricsSSS(serverStatusResponse) {
    assert(serverStatusResponse.hasOwnProperty("electionMetrics"),
           () => (`Expected the serverStatus response to have an 'electionMetrics' field:
${tojson(serverStatusResponse)}`));
    verifyElectionReasonCounterFields(serverStatusResponse, "stepUpCmd");
    verifyElectionReasonCounterFields(serverStatusResponse, "priorityTakeover");
    verifyElectionReasonCounterFields(serverStatusResponse, "catchUpTakeover");
    verifyElectionReasonCounterFields(serverStatusResponse, "electionTimeout");
    verifyElectionReasonCounterFields(serverStatusResponse, "freezeTimeout");
    verifyElectionMetricsField(serverStatusResponse, "numStepDownsCausedByHigherTerm");
    verifyElectionMetricsField(serverStatusResponse, "numCatchUps");
    verifyElectionMetricsField(serverStatusResponse, "numCatchUpsSucceeded");
    verifyElectionMetricsField(serverStatusResponse, "numCatchUpsAlreadyCaughtUp");
    verifyElectionMetricsField(serverStatusResponse, "numCatchUpsSkipped");
    verifyElectionMetricsField(serverStatusResponse, "numCatchUpsTimedOut");
    verifyElectionMetricsField(serverStatusResponse, "numCatchUpsFailedWithError");
    verifyElectionMetricsField(serverStatusResponse, "numCatchUpsFailedWithNewTerm");
    verifyElectionMetricsField(serverStatusResponse,
                               "numCatchUpsFailedWithReplSetAbortPrimaryCatchUpCmd");
}
function verifyElectionMetricsSSS ( serverStatusResponse ) { assert ( serverStatusResponse . hasOwnProperty ( "electionMetrics" ) , ( ) => ( ` ${ tojson ( serverStatusResponse ) } ` ) ) ; verifyElectionReasonCounterFields ( serverStatusResponse , "stepUpCmd" ) ; verifyElectionReasonCounterFields ( serverStatusResponse , "priorityTakeover" ) ; verifyElectionReasonCounterFields ( serverStatusResponse , "catchUpTakeover" ) ; verifyElectionReasonCounterFields ( serverStatusResponse , "electionTimeout" ) ; verifyElectionReasonCounterFields ( serverStatusResponse , "freezeTimeout" ) ; verifyElectionMetricsField ( serverStatusResponse , "numStepDownsCausedByHigherTerm" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUps" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUpsSucceeded" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUpsAlreadyCaughtUp" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUpsSkipped" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUpsTimedOut" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUpsFailedWithError" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUpsFailedWithNewTerm" ) ; verifyElectionMetricsField ( serverStatusResponse , "numCatchUpsFailedWithReplSetAbortPrimaryCatchUpCmd" ) ; }
Verifies the format of the 'electionMetrics' serverStatus section.
Verifies the format of the ' electionMetrics ' serverStatus section .