use of com.codahale.metrics.MetricRegistry in project dropwizard by dropwizard.
the class MultipleContentTypeTest method configure.
@Override
protected Application configure() {
forceSet(TestProperties.CONTAINER_PORT, "0");
final ViewRenderer renderer = new FreemarkerViewRenderer();
return DropwizardResourceConfig.forTesting(new MetricRegistry()).register(new ViewMessageBodyWriter(new MetricRegistry(), ImmutableList.of(renderer))).register(new InfoMessageBodyWriter()).register(new ExampleResource());
}
use of com.codahale.metrics.MetricRegistry in project hadoop by apache.
the class KMSWebApp method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent sce) {
try {
String confDir = System.getProperty(KMSConfiguration.KMS_CONFIG_DIR);
if (confDir == null) {
throw new RuntimeException("System property '" + KMSConfiguration.KMS_CONFIG_DIR + "' not defined");
}
kmsConf = KMSConfiguration.getKMSConf();
initLogging(confDir);
UserGroupInformation.setConfiguration(kmsConf);
LOG.info("-------------------------------------------------------------");
LOG.info(" Java runtime version : {}", System.getProperty("java.runtime.version"));
LOG.info(" User: {}", System.getProperty("user.name"));
LOG.info(" KMS Hadoop Version: " + VersionInfo.getVersion());
LOG.info("-------------------------------------------------------------");
kmsAcls = new KMSACLs();
kmsAcls.startReloader();
metricRegistry = new MetricRegistry();
jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
jmxReporter.start();
generateEEKCallsMeter = metricRegistry.register(GENERATE_EEK_METER, new Meter());
decryptEEKCallsMeter = metricRegistry.register(DECRYPT_EEK_METER, new Meter());
adminCallsMeter = metricRegistry.register(ADMIN_CALLS_METER, new Meter());
keyCallsMeter = metricRegistry.register(KEY_CALLS_METER, new Meter());
invalidCallsMeter = metricRegistry.register(INVALID_CALLS_METER, new Meter());
unauthorizedCallsMeter = metricRegistry.register(UNAUTHORIZED_CALLS_METER, new Meter());
unauthenticatedCallsMeter = metricRegistry.register(UNAUTHENTICATED_CALLS_METER, new Meter());
kmsAudit = new KMSAudit(kmsConf);
// intializing the KeyProvider
String providerString = kmsConf.get(KMSConfiguration.KEY_PROVIDER_URI);
if (providerString == null) {
throw new IllegalStateException("No KeyProvider has been defined");
}
KeyProvider keyProvider = KeyProviderFactory.get(new URI(providerString), kmsConf);
if (kmsConf.getBoolean(KMSConfiguration.KEY_CACHE_ENABLE, KMSConfiguration.KEY_CACHE_ENABLE_DEFAULT)) {
long keyTimeOutMillis = kmsConf.getLong(KMSConfiguration.KEY_CACHE_TIMEOUT_KEY, KMSConfiguration.KEY_CACHE_TIMEOUT_DEFAULT);
long currKeyTimeOutMillis = kmsConf.getLong(KMSConfiguration.CURR_KEY_CACHE_TIMEOUT_KEY, KMSConfiguration.CURR_KEY_CACHE_TIMEOUT_DEFAULT);
keyProvider = new CachingKeyProvider(keyProvider, keyTimeOutMillis, currKeyTimeOutMillis);
}
LOG.info("Initialized KeyProvider " + keyProvider);
keyProviderCryptoExtension = KeyProviderCryptoExtension.createKeyProviderCryptoExtension(keyProvider);
keyProviderCryptoExtension = new EagerKeyGeneratorKeyProviderCryptoExtension(kmsConf, keyProviderCryptoExtension);
if (kmsConf.getBoolean(KMSConfiguration.KEY_AUTHORIZATION_ENABLE, KMSConfiguration.KEY_AUTHORIZATION_ENABLE_DEFAULT)) {
keyProviderCryptoExtension = new KeyAuthorizationKeyProvider(keyProviderCryptoExtension, kmsAcls);
}
LOG.info("Initialized KeyProviderCryptoExtension " + keyProviderCryptoExtension);
final int defaultBitlength = kmsConf.getInt(KeyProvider.DEFAULT_BITLENGTH_NAME, KeyProvider.DEFAULT_BITLENGTH);
LOG.info("Default key bitlength is {}", defaultBitlength);
LOG.info("KMS Started");
} catch (Throwable ex) {
System.out.println();
System.out.println("ERROR: Hadoop KMS could not be started");
System.out.println();
System.out.println("REASON: " + ex.toString());
System.out.println();
System.out.println("Stacktrace:");
System.out.println("---------------------------------------------------");
ex.printStackTrace(System.out);
System.out.println("---------------------------------------------------");
System.out.println();
System.exit(1);
}
}
use of com.codahale.metrics.MetricRegistry in project opennms by OpenNMS.
the class VacuumdIT method setUp.
@Before
public void setUp() throws Exception {
m_network.createStandardNetwork();
InputStream is = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/vacuumd/vacuumd-configuration.xml");
try {
VacuumdConfigFactory.setInstance(new VacuumdConfigFactory(is));
} finally {
IOUtils.closeQuietly(is);
}
m_eventdIpcMgr.setEventWriter(m_database);
EventExpander expander = new EventExpander(new MetricRegistry());
expander.setEventConfDao(new EmptyEventConfDao());
m_eventdIpcMgr.setEventExpander(expander);
Vacuumd.destroySingleton();
m_vacuumd = Vacuumd.getSingleton();
m_vacuumd.setEventManager(m_eventdIpcMgr);
m_vacuumd.init();
// Insert some empty nodes to avoid foreign-key violations on subsequent events/alarms
OnmsNode node = new OnmsNode(m_locationDao.getDefaultLocation(), "default-1");
node.setId(1);
m_nodeDao.save(node);
node = new OnmsNode(m_locationDao.getDefaultLocation(), "default-2");
node.setId(2);
m_nodeDao.save(node);
m_nodeDao.flush();
MockUtil.println("------------ Finished setup for: " + this.getClass().getName() + " --------------------------");
}
use of com.codahale.metrics.MetricRegistry in project graylog2-server by Graylog2.
the class SearchesTest method setUp.
@Before
public void setUp() throws Exception {
when(indexRangeService.find(any(DateTime.class), any(DateTime.class))).thenReturn(INDEX_RANGES);
metricRegistry = new MetricRegistry();
searches = new Searches(new Configuration(), indexRangeService, client, metricRegistry, streamService, mock(Indices.class));
}
use of com.codahale.metrics.MetricRegistry in project graylog2-server by Graylog2.
the class IndicesGetAllMessageFieldsTest method setUp.
@Before
public void setUp() throws Exception {
elasticsearchRule.getDatabaseOperation().deleteAll();
indices = new Indices(client, new IndexMapping(), new Messages(client, new MetricRegistry()), mock(NodeId.class), new NullAuditEventSender());
}
Aggregations