emit metric

This commit is contained in:
Wei 2017-09-29 14:49:11 -07:00
parent abed367da0
commit 6ab1503fe3

View file

@ -119,9 +119,9 @@ public class PrefetchGetRecordsCache implements GetRecordsCache {
log.warn("Prefetch thread was interrupted."); log.warn("Prefetch thread was interrupted.");
break; break;
} }
MetricsHelper.startScope(metricsFactory, "ProcessTask");
if (prefetchCounters.shouldGetNewRecords()) { if (prefetchCounters.shouldGetNewRecords()) {
try { try {
MetricsHelper.startScope(metricsFactory, "Prefetcheing");
GetRecordsResult getRecordsResult = getRecordsRetrievalStrategy.getRecords(maxRecordsPerCall); GetRecordsResult getRecordsResult = getRecordsRetrievalStrategy.getRecords(maxRecordsPerCall);
ProcessRecordsInput processRecordsInput = new ProcessRecordsInput() ProcessRecordsInput processRecordsInput = new ProcessRecordsInput()
.withRecords(getRecordsResult.getRecords()) .withRecords(getRecordsResult.getRecords())
@ -131,6 +131,8 @@ public class PrefetchGetRecordsCache implements GetRecordsCache {
prefetchCounters.added(processRecordsInput); prefetchCounters.added(processRecordsInput);
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.info("Thread was interrupted, indicating shutdown was called on the cache"); log.info("Thread was interrupted, indicating shutdown was called on the cache");
} finally {
MetricsHelper.endScope();
} }
} }
} }