use of io.mantisrx.common.metrics.spectator.GaugeCallback in project mantis by Netflix.
the class SchedulingService method setupSchedulingServiceWatcherMetric.
private void setupSchedulingServiceWatcherMetric() {
logger.info("Setting up SchedulingServiceWatcher metrics");
lastSchedulingResultCallback.set(System.currentTimeMillis());
final String metricGroup = "SchedulingServiceWatcher";
final GaugeCallback timeSinceLastSchedulingRunGauge = new GaugeCallback(new MetricId(metricGroup, "timeSinceLastSchedulingRunMs"), () -> (double) (System.currentTimeMillis() - lastSchedulingResultCallback.get()), SpectatorRegistryFactory.getRegistry());
final Metrics schedulingServiceWatcherMetrics = new Metrics.Builder().id(metricGroup).addGauge(timeSinceLastSchedulingRunGauge).build();
MetricsRegistry.getInstance().registerAndGet(schedulingServiceWatcherMetrics);
}
Aggregations