use of com.walmartlabs.concord.server.sdk.metrics.GaugeProvider in project concord by walmartlabs.
the class ProcessQueueGaugeModule method configure.
@Override
@SuppressWarnings("rawtypes")
protected void configure() {
Provider<ProcessQueueDao> queueDaoProvider = getProvider(ProcessQueueDao.class);
// create the base gauge that caches all individual values
Gauge<Map<String, Integer>> base = new CachedGauge<Map<String, Integer>>(15, TimeUnit.SECONDS) {
@Override
protected Map<String, Integer> loadValue() {
return queueDaoProvider.get().getStatistics();
}
};
Multibinder<GaugeProvider> gauges = Multibinder.newSetBinder(binder(), GaugeProvider.class);
gauges.addBinding().toInstance(createBaseProvider(base));
for (ProcessStatus s : ProcessStatus.values()) {
gauges.addBinding().toInstance(create(base, s.toString()));
}
gauges.addBinding().toInstance(create(base, ProcessQueueDao.ENQUEUED_NOW_METRIC));
}
Aggregations