metric for lastUpdate
This commit is contained in:
parent
91fccbae7f
commit
0a5c711629
|
@ -0,0 +1,19 @@
|
|||
package eu.dnetlib.broker.common.metrics;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import eu.dnetlib.common.metrics.MetricInfo;
|
||||
|
||||
@Component("provide_broker_last_metrics_updater_run_timestamp_seconds")
|
||||
public class LastUpdateMetric extends MetricInfo {
|
||||
|
||||
@Autowired
|
||||
private MetricsCacheUtils metricsCacheUtils;
|
||||
|
||||
@Override
|
||||
public double obtainValue() {
|
||||
return metricsCacheUtils.lastUpdateInSeconds();
|
||||
}
|
||||
|
||||
}
|
|
@ -73,6 +73,12 @@ public class MetricsCacheUtils {
|
|||
return subscriptionRepository.countSubscribers();
|
||||
}
|
||||
|
||||
@Cacheable(value = MetricsCacheUtils.metrics_cache, key = "#root.methodName")
|
||||
public double lastUpdateInSeconds() {
|
||||
log.debug("Call to cached method: lastUpdateInSeconds()");
|
||||
return System.currentTimeMillis() / 1000;
|
||||
}
|
||||
|
||||
@Cacheable(value = MetricsCacheUtils.metrics_cache, key = "#root.methodName")
|
||||
public double countDatasourcesWithSubscriptions() {
|
||||
log.debug("Call to cached method: countDatasourcesWithSubscriptions()");
|
||||
|
|
Loading…
Reference in New Issue