You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/14 07:04:02 UTC

[GitHub] [pulsar] MarvinCai edited a comment on issue #10016: pulsar_ml_cache_used_size Prometheus metric is negative (Pulsar 2.6.1)

MarvinCai edited a comment on issue #10016:
URL: https://github.com/apache/pulsar/issues/10016#issuecomment-819281424


   The cache_used_size is get from [here](https://github.com/apache/pulsar/blob/f800fde9f27b2e14994f822b8ddac4d01583fb08/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryMBeanImpl.java#L74) which is stored in `EntryCacheManager` , the cacheSize is decrement [here](https://github.com/apache/pulsar/blob/f800fde9f27b2e14994f822b8ddac4d01583fb08/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryCacheManager.java#L140), and the only place I find can possibly make it negative is [here](https://github.com/apache/pulsar/blob/f800fde9f27b2e14994f822b8ddac4d01583fb08/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/RangeCache.java#L238), when clearing a cache we're returning entry cache size before entries removal instead of the size of entries removed.
   I'll have a patch for it.
   But IMO this metrics is not very accurate as when it's calculated using Bytebuf.readableByte, and when we remove entry from cache after we consuming it, the readableByte will be smaller than before, which means we're not properly reducing the size of cached entries.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org