Search in sources :

Example 1 with GaugeProvider

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));
}
Also used : ProcessStatus(com.walmartlabs.concord.server.sdk.ProcessStatus) CachedGauge(com.codahale.metrics.CachedGauge) GaugeProvider(com.walmartlabs.concord.server.sdk.metrics.GaugeProvider) Map(java.util.Map)

Aggregations

CachedGauge (com.codahale.metrics.CachedGauge)1 ProcessStatus (com.walmartlabs.concord.server.sdk.ProcessStatus)1 GaugeProvider (com.walmartlabs.concord.server.sdk.metrics.GaugeProvider)1 Map (java.util.Map)1