Skip to content

Commit 860ea64

Browse files
author
annie-mac
committed
update
1 parent 66ecb91 commit 860ea64

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/changeFeedMetrics/ChangeFeedMetricsTracker.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ private[cosmos] class ChangeFeedMetricsTracker(
4141
* @param changesPerLsn The latest changes per lsn metric.
4242
*/
4343
def track(lsnGap: Long, changesFetchedCnt: Long): Unit = {
44-
val changesPerLsn = changesFetchedCnt.toDouble / lsnGap
44+
val effectiveChangesFetchedCnt = Math.max(1, changesFetchedCnt)
45+
val changesPerLsn = effectiveChangesFetchedCnt.toDouble / lsnGap
4546
synchronized {
4647
changeFeedChangesPerLsnHistory.add(changesPerLsn)
4748
calculateWeightedChangesPerLsn()

0 commit comments

Comments
 (0)