646: Provided wrapper for histogram #649
Open
+226
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #646
Brief change log
Increased coverage for
FlinkCounter
,FlinkGauge
,FlinkHistogram
,FlinkHistogramStatistics
,FlinkMeter
.Tests
FlinkCounterTest
,FlinkHistogramStatisticsTest
,FlinkHistogramTest
,FlinkMeterTest
,FlinkMetricsITCase
API and Format
Documentation
I initially went for the direction of increasing the coverage through FlinkMetricsITCase,
Yet could not find ways to invoke the creation of
Counter
or the methods missing coverage from the other metric classes.I went to implement tests per metric.
Since those classes are wrapper classes (
FlinkCounter
,FlinkGauge
FlinkHistogram
FlinkMeter
) I proceeded on testing their proxy behaviour.I created WrapperMetricsTestSuite which lists all the public methods expected to be proxied and invokes those methods.
Onwards it checks if the underlying wrapped metric instance has been invoked for the corresponding method.
Another option was to test each class and verify invocations for every public method, for example:
Can switch to this direction if requested.
The FlinkHistogramStatistics class was not used.
I proceeded to create an instances of it during the initialization of FlinkHistogram, thus wrapping the original statistics instance.
Whenever
FlinkHistogram.getStatistics
is called it returns back the Wrapper instance ofFlinkHistogramStatistics
.