Class MetricsTest
java.lang.Object
org.apache.kafka.common.metrics.MetricsTest
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetup()voidvoidvoidtearDown()voidvoidVerifies that concurrent sensor add, remove, updates and read don't result in errors or deadlock.voidVerifies that concurrent sensor add, remove, updates and read with a metrics reporter that synchronizes on every reporter method doesn't result in errors or deadlock.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidSome implementations of SampledStat make sense to return the initial value when there are no values setvoidSome implementations of SampledStat make sense to return NaN when there are no values set rather than the initial valuevoidvoidvoidvoidThis test records 'NaN' events in a sample and validates metric reading is reported as 'NaN'voidThis test records negative metric values and ensures they're reported correctlyvoidThis test measures the metric when there is no event / sample recordedvoidThis test records a single sample and expects a NaN recording even after the sample window has elapsed.voidVerifies the weighted average implementation is computed correctly for a given sensor and a given sample window.
-
Constructor Details
-
MetricsTest
public MetricsTest()
-
-
Method Details
-
setup
@BeforeEach public void setup() -
tearDown
-
testMetricName
@Test public void testMetricName() -
testManyMetricNamesWithSameMeasurableStat
@Test public void testManyMetricNamesWithSameMeasurableStat() -
testSimpleStats
@Test public void testSimpleStats() -
testHierarchicalSensors
@Test public void testHierarchicalSensors() -
testBadSensorHierarchy
@Test public void testBadSensorHierarchy() -
testRemoveChildSensor
@Test public void testRemoveChildSensor() -
testRemoveSensor
@Test public void testRemoveSensor() -
testRemoveSensorWithRemovalCallback
@Test public void testRemoveSensorWithRemovalCallback() -
testEmitWhenNonDefaultMetrics
@Test public void testEmitWhenNonDefaultMetrics() -
testRemoveInactiveMetrics
@Test public void testRemoveInactiveMetrics() -
testRemoveMetric
@Test public void testRemoveMetric() -
testTimeWindowing
@Test public void testTimeWindowing() -
testOldDataHasNoEffect
@Test public void testOldDataHasNoEffect() -
testSampledStatReturnsNaNWhenNoValuesExist
@Test public void testSampledStatReturnsNaNWhenNoValuesExist()Some implementations of SampledStat make sense to return NaN when there are no values set rather than the initial value -
testSampledStatReturnsInitialValueWhenNoValuesExist
@Test public void testSampledStatReturnsInitialValueWhenNoValuesExist()Some implementations of SampledStat make sense to return the initial value when there are no values set -
testDuplicateMetricName
@Test public void testDuplicateMetricName() -
testQuotas
@Test public void testQuotas() -
testQuotasEquality
@Test public void testQuotasEquality() -
testPercentiles
@Test public void testPercentiles() -
shouldPinSmallerValuesToMin
@Test public void shouldPinSmallerValuesToMin() -
shouldPinLargerValuesToMax
@Test public void shouldPinLargerValuesToMax() -
testPercentilesWithRandomNumbersAndLinearBucketing
@Test public void testPercentilesWithRandomNumbersAndLinearBucketing() -
testRateWindowing
@Test public void testRateWindowing() -
testSimpleRate
@Test public void testSimpleRate() -
testMetricInstances
@Test public void testMetricInstances() -
testConcurrentReadUpdate
@Test public void testConcurrentReadUpdate()Verifies that concurrent sensor add, remove, updates and read don't result in errors or deadlock. -
testConcurrentReadUpdateReport
@Test public void testConcurrentReadUpdateReport()Verifies that concurrent sensor add, remove, updates and read with a metrics reporter that synchronizes on every reporter method doesn't result in errors or deadlock. -
testWeightedAverageNoSamples
@Test public void testWeightedAverageNoSamples()This test measures the metric when there is no event / sample recorded -
testWeightedAverageOneSample
@Test public void testWeightedAverageOneSample()This test records a single sample and expects a NaN recording even after the sample window has elapsed. In the absence of any other sample, the metric should always report NaN. -
testWeightedAverageNegativeSamples
@Test public void testWeightedAverageNegativeSamples()This test records negative metric values and ensures they're reported correctly -
testWeightedAverageNaNSamples
@Test public void testWeightedAverageNaNSamples()This test records 'NaN' events in a sample and validates metric reading is reported as 'NaN' -
testWeightedAverageStat
@Test public void testWeightedAverageStat()Verifies the weighted average implementation is computed correctly for a given sensor and a given sample window. The test records 1 event per sample. This test also wraps around the circular buffer by recording more than the configured number of samples in a window.
-