Class PercentageThreshold


  • public class PercentageThreshold
    extends MaxThreshold
    A Threshold guardrail whose values represent a percentage

    This works exactly as a Threshold, but provides slightly more convenient error messages for percentage

    • Constructor Detail

      • PercentageThreshold

        public PercentageThreshold​(java.lang.String name,
                                   java.util.function.ToLongFunction<ClientState> warnThreshold,
                                   java.util.function.ToLongFunction<ClientState> failThreshold,
                                   org.apache.cassandra.db.guardrails.Threshold.ErrorMessageProvider messageProvider)
        Creates a new threshold guardrail.
        Parameters:
        name - the identifying name of the guardrail
        warnThreshold - a ClientState-based provider of the value above which a warning should be triggered.
        failThreshold - a ClientState-based provider of the value above which the operation should be aborted.
        messageProvider - a function to generate the warning or error message if the guardrail is triggered
    • Method Detail

      • errMsg

        protected java.lang.String errMsg​(boolean isWarning,
                                          java.lang.String what,
                                          long value,
                                          long thresholdValue)
        Overrides:
        errMsg in class Threshold