Search in sources :

Example 1 with GaugeCallback

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);
}
Also used : GaugeCallback(io.mantisrx.common.metrics.spectator.GaugeCallback) MetricId(io.mantisrx.common.metrics.spectator.MetricId) Metrics(io.mantisrx.common.metrics.Metrics)

Aggregations

Metrics (io.mantisrx.common.metrics.Metrics)1 GaugeCallback (io.mantisrx.common.metrics.spectator.GaugeCallback)1 MetricId (io.mantisrx.common.metrics.spectator.MetricId)1