[ https://issues.apache.org/jira/browse/IGNITE-6630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Pereslegin updated IGNITE-6630: ------------------------------------- Description: AverageTxCommitTime and AverageTxRollbackTime metrics in CacheMetrics counts in milliseconds instead of microseconds as pointed in javadoc. Simple junit reproducer: {code:java} public class CacheMetricsTxAvgTimeTest extends GridCommonAbstractTest { /** */ private <K, V> CacheConfiguration<K, V> cacheConfiguration(String name) { CacheConfiguration<K, V> cacheConfiguration = new CacheConfiguration<>(name); cacheConfiguration.setCacheMode(CacheMode.PARTITIONED); cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheConfiguration.setStatisticsEnabled(true); return cacheConfiguration; } /** */ public void testTxCommitDuration() throws Exception { try ( Ignite node = startGrid(0)) { IgniteCache<Object, Object> cache = node.createCache(cacheConfiguration(DEFAULT_CACHE_NAME)); try (Transaction tx = node.transactions().txStart()) { cache.put(1, 1); // Await 1 second. U.sleep(1_000); tx.commit(); } // Documentation says that this metric is in microseconds. float commitTime = cache.metrics().getAverageTxCommitTime(); // But this assertion will fail because it in milliseconds and returns only ~1000. assert commitTime >= 1_000_000; } } } {code} was: AverageTxCommitTime and AverageTxRollbackTime metrics in CacheMetrics calculated in milliseconds instead of microseconds as pointed in javadoc. Simple junit reproducer: {code:java} public class CacheMetricsTxAvgTimeTest extends GridCommonAbstractTest { /** */ private <K, V> CacheConfiguration<K, V> cacheConfiguration(String name) { CacheConfiguration<K, V> cacheConfiguration = new CacheConfiguration<>(name); cacheConfiguration.setCacheMode(CacheMode.PARTITIONED); cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheConfiguration.setStatisticsEnabled(true); return cacheConfiguration; } /** */ public void testTxCommitDuration() throws Exception { try ( Ignite node = startGrid(0)) { IgniteCache<Object, Object> cache = node.createCache(cacheConfiguration(DEFAULT_CACHE_NAME)); try (Transaction tx = node.transactions().txStart()) { cache.put(1, 1); // Await 1 second. U.sleep(1_000); tx.commit(); } // Documentation says that this metric is in microseconds. float commitTime = cache.metrics().getAverageTxCommitTime(); // But this assertion will fail because it in milliseconds and returns only ~1000. assert commitTime >= 1_000_000; } } } {code} > Incorrect time units of average transaction commit/rollback duration cache > metrics. > ----------------------------------------------------------------------------------- > > Key: IGNITE-6630 > URL: https://issues.apache.org/jira/browse/IGNITE-6630 > Project: Ignite > Issue Type: Bug > Reporter: Pavel Pereslegin > Assignee: Pavel Pereslegin > Priority: Minor > Labels: metrics, newbie > > AverageTxCommitTime and AverageTxRollbackTime metrics in CacheMetrics counts > in milliseconds instead of microseconds as pointed in javadoc. > Simple junit reproducer: > {code:java} > public class CacheMetricsTxAvgTimeTest extends GridCommonAbstractTest { > /** */ > private <K, V> CacheConfiguration<K, V> cacheConfiguration(String name) { > CacheConfiguration<K, V> cacheConfiguration = new > CacheConfiguration<>(name); > cacheConfiguration.setCacheMode(CacheMode.PARTITIONED); > cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); > cacheConfiguration.setStatisticsEnabled(true); > return cacheConfiguration; > } > /** */ > public void testTxCommitDuration() throws Exception { > try ( Ignite node = startGrid(0)) { > IgniteCache<Object, Object> cache = > node.createCache(cacheConfiguration(DEFAULT_CACHE_NAME)); > try (Transaction tx = node.transactions().txStart()) { > cache.put(1, 1); > // Await 1 second. > U.sleep(1_000); > tx.commit(); > } > // Documentation says that this metric is in microseconds. > float commitTime = cache.metrics().getAverageTxCommitTime(); > // But this assertion will fail because it in milliseconds and > returns only ~1000. > assert commitTime >= 1_000_000; > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)