All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gwizard.metrics.MetricsModule Maven / Gradle / Ivy

There is a newer version: 1.1.6
Show newest version
package org.gwizard.metrics;

import com.codahale.metrics.MetricRegistry;
import com.google.inject.AbstractModule;
import com.palominolabs.metrics.guice.MetricsInstrumentationModule;
import lombok.EqualsAndHashCode;
import org.gwizard.services.ServicesModule;

/**
 * Add the metrics-guice MetricsInstrumentationModule to scan for metrics annotations.
 */
@EqualsAndHashCode(callSuper=false, of={})	// makes installation of this module idempotent
public class MetricsModule extends AbstractModule {
	private final MetricRegistry metricRegistry = new MetricRegistry();

	@Override
	protected void configure() {
		install(new ServicesModule());

		bind(MetricRegistry.class).toInstance(metricRegistry);

		install(MetricsInstrumentationModule.builder().withMetricRegistry(metricRegistry).build());

		bind(MetricsService.class).asEagerSingleton();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy