mirror of https://github.com/apache/druid.git
fix messageGap metric (#12337)
This commit is contained in:
parent
9c6b9abcde
commit
f2495a67d2
|
@ -263,7 +263,8 @@ public class FireDepartmentMetrics
|
|||
retVal.messageMaxTimestamp.set(messageMaxTimestamp.get());
|
||||
retVal.messageProcessingCompletionTime.set(messageProcessingCompletionTime.get());
|
||||
retVal.messageProcessingCompletionTime.compareAndSet(DEFAULT_PROCESSING_COMPLETION_TIME, System.currentTimeMillis());
|
||||
retVal.messageGap.set(retVal.messageProcessingCompletionTime.get() - messageMaxTimestamp.get());
|
||||
long maxTimestamp = retVal.messageMaxTimestamp.get();
|
||||
retVal.messageGap.set(maxTimestamp > 0 ? retVal.messageProcessingCompletionTime.get() - maxTimestamp : 0L);
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,12 @@ public class FireDepartmentMetricsTest
|
|||
metrics = new FireDepartmentMetrics();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSnapshotBeforeProcessing()
|
||||
{
|
||||
Assert.assertEquals(0L, metrics.snapshot().messageGap());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSnapshotAfterProcessingOver()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue