Skip to content

Commit

Permalink
IGNITE-1071 IgniteCache.metrics() method returns local metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-vinogradov committed Mar 28, 2016
1 parent 134f26e commit f17b2ae
Show file tree
Hide file tree
Showing 28 changed files with 1,023 additions and 481 deletions.
Expand Up @@ -412,9 +412,9 @@ public void testMetrics() throws Exception {
IgniteCache<Object, Object> jcacheDft = grid().cache(null); IgniteCache<Object, Object> jcacheDft = grid().cache(null);
IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME); IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME);


jcacheDft.mxBean().clear(); jcacheDft.localMxBean().clear();


jcacheName.mxBean().clear(); jcacheName.localMxBean().clear();


jcacheDft.put("key1", "val"); jcacheDft.put("key1", "val");
jcacheDft.put("key2", "val"); jcacheDft.put("key2", "val");
Expand Down
Expand Up @@ -205,8 +205,8 @@ public void testReplace() throws Exception {
* @throws Exception If failed. * @throws Exception If failed.
*/ */
public void testMetrics() throws Exception { public void testMetrics() throws Exception {
grid().cache(null).mxBean().clear(); grid().cache(null).localMxBean().clear();
grid().cache(CACHE_NAME).mxBean().clear(); grid().cache(CACHE_NAME).localMxBean().clear();


grid().cache(null).put("key1", "val"); grid().cache(null).put("key1", "val");
grid().cache(null).put("key2", "val"); grid().cache(null).put("key2", "val");
Expand Down
20 changes: 17 additions & 3 deletions modules/core/src/main/java/org/apache/ignite/IgniteCache.java
Expand Up @@ -715,24 +715,38 @@ public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
public IgniteFuture<?> rebalance(); public IgniteFuture<?> rebalance();


/** /**
* Gets snapshot metrics (statistics) for this cache. * Gets whole cluster snapshot metrics (statistics) for this cache.
* *
* @return Cache metrics. * @return Cache metrics.
*/ */
public CacheMetrics metrics(); public CacheMetrics metrics();


/** /**
* Gets snapshot metrics for caches in cluster group. * Gets cluster group snapshot metrics for caches in cluster group.
* *
* @param grp Cluster group. * @param grp Cluster group.
* @return Cache metrics. * @return Cache metrics.
*/ */
public CacheMetrics metrics(ClusterGroup grp); public CacheMetrics metrics(ClusterGroup grp);


/** /**
* Gets MxBean for this cache. * Gets local snapshot metrics (statistics) for this cache.
*
* @return Cache metrics.
*/
public CacheMetrics localMetrics();

/**
* Gets whole cluster MxBean for this cache.
* *
* @return MxBean. * @return MxBean.
*/ */
public CacheMetricsMXBean mxBean(); public CacheMetricsMXBean mxBean();

/**
* Gets local MxBean for this cache.
*
* @return MxBean.
*/
public CacheMetricsMXBean localMxBean();
} }
Expand Up @@ -908,7 +908,7 @@ private DiscoveryMetricsProvider createMetricsProvider() {
if (metrics == null) if (metrics == null)
metrics = U.newHashMap(caches.size()); metrics = U.newHashMap(caches.size());


metrics.put(cache.context().cacheId(), cache.metrics()); metrics.put(cache.context().cacheId(), cache.localMetrics());
} }
} }


Expand Down

0 comments on commit f17b2ae

Please sign in to comment.