Class TestMetricsUtils
java.lang.Object
org.apache.kafka.common.network.netty.TestMetricsUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.common.network.Selector.SelectorMetricscreateTestSelectorMetrics(org.apache.kafka.common.metrics.Metrics metrics) Creates an instance ofSelector.SelectorMetricsfor unit testing.static org.apache.kafka.common.network.Selector.SelectorMetricscreateTestSelectorMetrics(org.apache.kafka.common.metrics.Metrics metrics, Set<String> mechanisms) Creates an instance ofSelector.SelectorMetricsfor unit testing.static doublemetricValue(org.apache.kafka.common.metrics.Metrics metrics, String name) Equivalent toNioEchoServer.metricValue(String)static doublemetricValue(org.apache.kafka.common.metrics.Metrics metrics, String name, String tagName, String tagValue) Equivalent toNioEchoServer.metricValue(String, String)withtagNameequal to "mechanism" andtagValueequal to the provided mechanism.static voidverifyAuthenticationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int failedAuthentications) Equivalent toNioEchoServer.verifyAuthenticationMetrics(int, int)static voidverifyAuthenticationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int successfulAuthenticationsNoReauth, int failedAuthentications) More comprehensive version of {#verifyAuthenticationMetrics(Metrics, Time, int, int)} that also verifies the number of successful authentications without reauthentication and the authentication time metrics.static voidverifyAuthenticationMetricsForMechanism(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int failedAuthentications, String mechanism) static voidverifyAuthenticationMetricsForMechanism(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int failedAuthentications, String mechanism, Set<NioEchoServer.MetricType> set) static voidverifyFailedLkcValidationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int failedLkcValidations, String tenant) static voidverifyReauthenticationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulReauthentications, int successfulReauthenticationsNoReauth, int failedReauthentications) Equivalent toNioEchoServer.verifyReauthenticationMetrics(int, int)static voidwaitForMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes) Equivalent toNioEchoServer.waitForMetrics(String, double, Set)static voidwaitForMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes, String tagName, String tagValue) Equivalent toNioEchoServer.waitForMetrics(String, double, Set, String)withtagNameequal to "mechanism" andtagValueequal to the provided mechanism.
-
Method Details
-
createTestSelectorMetrics
public static org.apache.kafka.common.network.Selector.SelectorMetrics createTestSelectorMetrics(org.apache.kafka.common.metrics.Metrics metrics) Creates an instance ofSelector.SelectorMetricsfor unit testing.- Parameters:
metrics- the Metrics instance to use- Returns:
- a new instance of
Selector.SelectorMetrics
-
createTestSelectorMetrics
public static org.apache.kafka.common.network.Selector.SelectorMetrics createTestSelectorMetrics(org.apache.kafka.common.metrics.Metrics metrics, Set<String> mechanisms) Creates an instance ofSelector.SelectorMetricsfor unit testing.- Parameters:
metrics- the Metrics instance to usemechanisms- the set of authentication mechanisms to use- Returns:
- a new instance of
Selector.SelectorMetrics
-
metricValue
Equivalent toNioEchoServer.metricValue(String) -
metricValue
public static double metricValue(org.apache.kafka.common.metrics.Metrics metrics, String name, String tagName, String tagValue) Equivalent toNioEchoServer.metricValue(String, String)withtagNameequal to "mechanism" andtagValueequal to the provided mechanism. -
verifyFailedLkcValidationMetrics
public static void verifyFailedLkcValidationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int failedLkcValidations, String tenant) throws InterruptedException - Throws:
InterruptedException
-
verifyAuthenticationMetrics
public static void verifyAuthenticationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int failedAuthentications) throws InterruptedException Equivalent toNioEchoServer.verifyAuthenticationMetrics(int, int)- Throws:
InterruptedException
-
verifyAuthenticationMetrics
public static void verifyAuthenticationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int successfulAuthenticationsNoReauth, int failedAuthentications) throws InterruptedException More comprehensive version of {#verifyAuthenticationMetrics(Metrics, Time, int, int)} that also verifies the number of successful authentications without reauthentication and the authentication time metrics.- Throws:
InterruptedException
-
verifyReauthenticationMetrics
public static void verifyReauthenticationMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulReauthentications, int successfulReauthenticationsNoReauth, int failedReauthentications) throws InterruptedException Equivalent toNioEchoServer.verifyReauthenticationMetrics(int, int)- Throws:
InterruptedException
-
verifyAuthenticationMetricsForMechanism
public static void verifyAuthenticationMetricsForMechanism(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int failedAuthentications, String mechanism) throws InterruptedException - Throws:
InterruptedException
-
verifyAuthenticationMetricsForMechanism
public static void verifyAuthenticationMetricsForMechanism(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, int successfulAuthentications, int failedAuthentications, String mechanism, Set<NioEchoServer.MetricType> set) throws InterruptedException - Throws:
InterruptedException
-
waitForMetrics
public static void waitForMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes) throws InterruptedException Equivalent toNioEchoServer.waitForMetrics(String, double, Set)- Throws:
InterruptedException
-
waitForMetrics
public static void waitForMetrics(org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes, String tagName, String tagValue) throws InterruptedException Equivalent toNioEchoServer.waitForMetrics(String, double, Set, String)withtagNameequal to "mechanism" andtagValueequal to the provided mechanism.- Throws:
InterruptedException
-