use of com.codahale.metrics.MetricRegistry in project opennms by OpenNMS.
the class SyslogdIT method setUp.
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
MockLogAppender.resetState();
InputStream stream = null;
try {
stream = ConfigurationTestUtils.getInputStreamForResource(this, "/etc/syslogd-configuration.xml");
m_config = new SyslogdConfigFactory(stream);
} finally {
if (stream != null) {
IOUtils.closeQuietly(stream);
}
}
// Verify that the test syslogd-configuration.xml file was loaded
boolean foundBeer = false;
boolean foundMalt = false;
assertEquals(10514, m_config.getSyslogPort());
for (final UeiMatch match : m_config.getUeiList()) {
if (match.getProcessMatch().isPresent()) {
final ProcessMatch processMatch = match.getProcessMatch().get();
if (!foundBeer && "beerd".equals(processMatch.getExpression())) {
foundBeer = true;
} else if (!foundMalt && "maltd".equals(processMatch.getExpression())) {
foundMalt = true;
}
}
}
assertTrue(foundBeer);
assertTrue(foundMalt);
m_syslogSinkConsumer = new SyslogSinkConsumer(new MetricRegistry());
m_syslogSinkConsumer.setDistPollerDao(m_distPollerDao);
m_syslogSinkConsumer.setSyslogdConfig(m_config);
m_syslogSinkConsumer.setEventForwarder(m_eventIpcManager);
m_syslogSinkModule = m_syslogSinkConsumer.getModule();
m_messageDispatcherFactory.setConsumer(m_syslogSinkConsumer);
SyslogReceiverJavaNetImpl receiver = new SyslogReceiverJavaNetImpl(m_config);
receiver.setDistPollerDao(m_distPollerDao);
receiver.setMessageDispatcherFactory(m_messageDispatcherFactory);
m_syslogd.setSyslogReceiver(receiver);
m_syslogd.init();
SyslogdTestUtils.startSyslogdGracefully(m_syslogd);
}
use of com.codahale.metrics.MetricRegistry in project opennms by OpenNMS.
the class EvaluateStatsIT method setUp.
/**
* Sets up the test.
*
* @throws Exception the exception
*/
@Before
public void setUp() throws Exception {
System.setProperty("org.opennms.rrd.storeByGroup", "true");
registry = new MetricRegistry();
stats = new EvaluateStats(registry, 5, 10);
}
use of com.codahale.metrics.MetricRegistry in project HikariCP by brettwooldridge.
the class TestMetrics method testMetricRegistrySubclassIsAllowed.
@Test
public void testMetricRegistrySubclassIsAllowed() {
try (HikariDataSource ds = newHikariDataSource()) {
ds.setMaximumPoolSize(1);
ds.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");
ds.setMetricRegistry(new MetricRegistry() {
@Override
public Timer timer(String name) {
return super.timer(name);
}
});
}
}
use of com.codahale.metrics.MetricRegistry in project grakn by graknlabs.
the class PostProcessingTest method setupPostProcessor.
@Before
public void setupPostProcessor() {
MetricRegistry metricRegistry = new MetricRegistry();
RedisIndexStorage indexStorage = RedisIndexStorage.create(engine.getJedisPool(), metricRegistry);
IndexPostProcessor indexPostProcessor = IndexPostProcessor.create(engine.server().lockProvider(), indexStorage);
RedisCountStorage countStorage = RedisCountStorage.create(engine.getJedisPool(), metricRegistry);
CountPostProcessor countPostProcessor = CountPostProcessor.create(engine.config(), engine.factory(), engine.server().lockProvider(), metricRegistry, countStorage);
session = engine.sessionWithNewKeyspace();
postProcessor = PostProcessor.create(indexPostProcessor, countPostProcessor);
}
use of com.codahale.metrics.MetricRegistry in project grakn by graknlabs.
the class EngineContext method startGraknEngineServer.
private GraknEngineServer startGraknEngineServer(RedisWrapper redisWrapper) throws IOException {
EngineID id = EngineID.me();
GraknEngineStatus status = new GraknEngineStatus();
MetricRegistry metricRegistry = new MetricRegistry();
// distributed locks
LockProvider lockProvider = new JedisLockProvider(redisWrapper.getJedisPool());
graknKeyspaceStore = GraknKeyspaceStoreImpl.create(new GraknSystemKeyspaceSession(config));
// tx-factory
engineGraknTxFactory = EngineGraknTxFactory.create(lockProvider, config, graknKeyspaceStore);
// post-processing
IndexStorage indexStorage = RedisIndexStorage.create(redisWrapper.getJedisPool(), metricRegistry);
CountStorage countStorage = RedisCountStorage.create(redisWrapper.getJedisPool(), metricRegistry);
IndexPostProcessor indexPostProcessor = IndexPostProcessor.create(lockProvider, indexStorage);
CountPostProcessor countPostProcessor = CountPostProcessor.create(config, engineGraknTxFactory, lockProvider, metricRegistry, countStorage);
PostProcessor postProcessor = PostProcessor.create(indexPostProcessor, countPostProcessor);
GrpcOpenRequestExecutor requestExecutor = new GrpcOpenRequestExecutorImpl(engineGraknTxFactory);
Server server = ServerBuilder.forPort(0).addService(new GrpcGraknService(requestExecutor, postProcessor)).build();
GrpcServer grpcServer = GrpcServer.create(server);
GraknTestUtil.allocateSparkPort(config);
QueueSanityCheck queueSanityCheck = new RedisSanityCheck(redisWrapper);
GraknEngineServer graknEngineServer = GraknEngineServerFactory.createGraknEngineServer(id, config, status, spark, Collections.emptyList(), grpcServer, engineGraknTxFactory, metricRegistry, queueSanityCheck, lockProvider, postProcessor, graknKeyspaceStore);
graknEngineServer.start();
// Read the automatically allocated ports and write them back into the config
config.setConfigProperty(GraknConfigKey.GRPC_PORT, server.getPort());
return graknEngineServer;
}
Aggregations