Commit d3168bbc by 张乐 Committed by GitHub

Merge pull request #338 from nobodyiam/configfile-cache-hit

record cache hit statistics
parents ba6c1699 ab38ec3a
...@@ -124,6 +124,7 @@ public class ConfigFileController implements ReleaseMessageListener{ ...@@ -124,6 +124,7 @@ public class ConfigFileController implements ReleaseMessageListener{
String result = localCache.getIfPresent(cacheKey); String result = localCache.getIfPresent(cacheKey);
if (Strings.isNullOrEmpty(result)) { if (Strings.isNullOrEmpty(result)) {
Cat.logEvent("ConfigFile-Cache-Miss", cacheKey);
ApolloConfig apolloConfig = ApolloConfig apolloConfig =
configController configController
.queryConfig(appId, clusterName, namespace, dataCenter, "-1", clientIp, .queryConfig(appId, clusterName, namespace, dataCenter, "-1", clientIp,
...@@ -148,6 +149,8 @@ public class ConfigFileController implements ReleaseMessageListener{ ...@@ -148,6 +149,8 @@ public class ConfigFileController implements ReleaseMessageListener{
cacheKey2WatchedKeys.putAll(cacheKey, watchedKeys); cacheKey2WatchedKeys.putAll(cacheKey, watchedKeys);
logger.debug("added cache for key: {}", cacheKey); logger.debug("added cache for key: {}", cacheKey);
} else {
Cat.logEvent("ConfigFile-Cache-Hit", cacheKey);
} }
return new ResponseEntity<>(result, responseHeaders, return new ResponseEntity<>(result, responseHeaders,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment