[ 
https://issues.apache.org/jira/browse/FLINK-35764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17863148#comment-17863148
 ] 

Liu Liu commented on FLINK-35764:
---------------------------------

Could someone assign this to me please?

> TimerGauge is incorrect when update is called during a measurement
> ------------------------------------------------------------------
>
>                 Key: FLINK-35764
>                 URL: https://issues.apache.org/jira/browse/FLINK-35764
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Metrics
>    Affects Versions: 1.15.0, 1.16.0, 1.17.0, 1.18.0, 1.19.0
>            Reporter: Liu Liu
>            Priority: Major
>
> Currently in {{{}TimerGauge{}}}, the {{currentMeasurement}} in {{markEnd}} is 
> incorrectly set to the time since the last {{{}markStart{}}}. When calling 
> {{{}markStart -> update -> markEnd{}}}, this will result in the time between 
> {{markStart}} and {{update}} being counted twice. A piece of test code that 
> reflects this scenario:
> {code:java}
> @Test  
> void testUpdateBeforeMarkingEnd() {  
>     ManualClock clock = new ManualClock(42_000_000);
>     // time span = 2 intervals
>     TimerGauge gauge = new TimerGauge(clock, 2 * 
> View.UPDATE_INTERVAL_SECONDS);  
>     // the event spans 2 intervals
>     // interval 1
>     gauge.markStart();  
>     clock.advanceTime(SLEEP, TimeUnit.MILLISECONDS);  
>     gauge.update();
>     // interval 2
>     clock.advanceTime(SLEEP, TimeUnit.MILLISECONDS);  
>     gauge.markEnd();  
>     gauge.update();  
>     // expected: 2, actual: 3
>     assertThat(gauge.getValue()).isEqualTo(SLEEP / 
> View.UPDATE_INTERVAL_SECONDS);  
> }
> {code}
> Proposed changes:
>  # Modify {{markEnd}} so that updates to {{currentCount}} and 
> {{accumulatedCount}} resembles those in {{{}update{}}}.
>  # Add the test case to {{{}TimeGaugeTest{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to