未验证 提交 5df7bebd 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Add counters for metrics reading from DB or cached. (#10025)

上级 8185589a
......@@ -80,7 +80,18 @@ public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
private final Optional<MetricsTransWorker> transWorker;
private final boolean supportUpdate;
private long sessionTimeout;
/**
* The counter of L2 aggregation.
*/
private CounterMetrics aggregationCounter;
/**
* The counter of metrics reading from Database.
*/
private CounterMetrics readMetricsCounter;
/**
* The counter of metrics cached in-memory.
*/
private CounterMetrics cachedMetricsCounter;
/**
* The counter for the round of persistent.
*/
......@@ -147,6 +158,14 @@ public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
new MetricsTag.Keys("metricName", "level", "dimensionality"),
new MetricsTag.Values(model.getName(), "2", model.getDownsampling().getName())
);
readMetricsCounter = metricsCreator.createCounter(
"metrics_persistent_cache", "The counter of metrics status, new or cached.",
new MetricsTag.Keys("status"), new MetricsTag.Values("new")
);
cachedMetricsCounter = metricsCreator.createCounter(
"metrics_persistent_cache", "The counter of metrics status, new or cached.",
new MetricsTag.Keys("status"), new MetricsTag.Values("cached")
);
SESSION_TIMEOUT_OFFSITE_COUNTER++;
}
......@@ -325,6 +344,9 @@ public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
return false;
})
.collect(Collectors.toList());
readMetricsCounter.inc(notInCacheMetrics.size());
cachedMetricsCounter.inc(metrics.size() - notInCacheMetrics.size());
if (notInCacheMetrics.isEmpty()) {
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册